Exemple #1
0
 def _display(self, request):
     return render(
         request, 'tguide-view.html', {
             'topmenu_items': topmenu_items('Guide', request),
             'username': UserAccessProfile(request).username,
             'title': 'Portal Teaching Guide',
         })
Exemple #2
0
    def get_context_data(self, **kwargs):
        page = Page(self.request)
        usera = UserAccessProfile(self.request)
        q = Account.objects.get(user_ref=usera.user_obj).quota_ref
        user_plan = q.quota_title
        user_quota_size = q.quota_size
        the_date = datetime.now(tz=timezone.get_current_timezone())  # timezone.now()
        curr_start = the_date.replace(day=1).replace(hour=0, minute=0, second=0)
        curr_end = last_day_of_month(datetime.today()).replace(hour=23, minute=59, second=59)
        # user_usage = get_month_usage_hr(usera.user_obj, the_date, 't')
        user_usage = get_month_usage_credit(usera.user_obj, the_date)
        user_usage_p = user_usage / user_quota_size * 100

        year_vl, year_vv = get_last_year(usera.user_obj, the_date, 'v')
        year_sl, year_sv = get_last_year(usera.user_obj, the_date, 's')
        year_l, year_v = get_last_year(usera.user_obj, the_date, 't')

        context = super(StatsView, self).get_context_data(**kwargs)
        context['user_plan'] = user_plan
        context['user_quota_size'] = user_quota_size
        context['user_usage'] = user_usage
        context['user_usage_p'] = user_usage_p
        context['curr_start'] = curr_start
        context['curr_end'] = curr_end
        context['year_vv'] = year_vv
        context['year_sv'] = year_sv
        context['year_l'] = year_l
        context['year_v'] = year_v

        context['username'] = UserAccessProfile(self.request).username  # the_user(self.request)
        context['topmenu_items'] = topmenu_items('Testbed View', page.request)
        prelude_env = page.prelude_env()
        context.update(prelude_env)
        return context
Exemple #3
0
    def get_context_data(self, **kwargs):
        # We might have slices on different registries with different user accounts
        # We note that this portal could be specific to a given registry, to which we register users, but i'm not sure that simplifies things
        # Different registries mean different identities, unless we identify via SFA HRN or have associated the user email to a single hrn

        # messages.info(self.request, 'You have logged in')
        page = Page(self.request)
        # the page header and other stuff
        usera = UserAccessProfile(self.request)
        # c_user_email =  the_user(self.request)
        c_user = usera.user_obj  # get_user_by_email(c_user_email)
        context = super(DashboardView, self).get_context_data(**kwargs)
        context['title'] = 'Dashboard'
        context['username'] = usera.username
        context['topmenu_items'] = topmenu_items('Dashboard', page.request)
        context['active_count'] = get_count_active_slice(
            c_user, usera.session_username)
        context['course_count'] = get_count_students_course(c_user)
        context['pending_count'] = get_count_students_pending(c_user)
        context['std_exp_count'] = get_count_students_experiments(c_user)
        context['student_count'] = get_count_students(c_user)
        context['request_count'] = get_count_requests(
        ) if usera.user_type == 0 else 0
        context['bulk_count'] = get_count_bulk_experiments(c_user)
        context['user_type'] = usera.user_type
        context.update(page.prelude_env())
        return context
Exemple #4
0
    def get_or_post(self, request, method):
        usera = UserAccessProfile(request)
        self.user_email = usera.username  # the_user(request)
        page = Page(request)

        self.errors = []
        # user = get_user_by_email(the_user(self.request))
        user_type = usera.user_type  # get_user_type(user)
        if user_type != 0:
            messages.error(
                page.request,
                'Error: You have not permission to access this page.')
            return HttpResponseRedirect("/")

        resourceslist = VirtualNode.objects.all()

        if method == 'POST':
            self.errors = []

        template_name = "fed-resources.html"
        template_env = {
            'topmenu_items': topmenu_items('Site Information', page.request),
            'username': usera.username,  # the_user(self.request),
            'resourceslist': resourceslist,
            'title': 'Resources Information',
        }
        template_env.update(page.prelude_env())
        return render(request, template_name, template_env)
Exemple #5
0
 def _display(self, request):
     return render(
         request, 'experiment-view.html', {
             'topmenu_items': topmenu_items('experiment', request),
             'username': UserAccessProfile(request).username,
             'title': 'Experiment Tools Information',
         })
Exemple #6
0
 def _display(self, request):
     return render(
         request, 'filemanager-view.html', {
             'topmenu_items': topmenu_items('filemanager', request),
             'username': UserAccessProfile(request).username,
             'title': 'User Cloud Disk Manager',
         })
Exemple #7
0
 def _display(self, request):
     return render(
         request, 'support-view.html', {
             'topmenu_items': topmenu_items('support', request),
             'username': UserAccessProfile(request).username,
             'title': 'Support',
         })
    def get_context_data(self, **kwargs):
        page = Page(self.request)
        page.add_js_files([
            "js/jquery.validate.js", "js/my_account.register.js",
            "js/my_account.edit_profile.js"
        ])
        page.add_css_files(["css/plugin.css"])

        usera = UserAccessProfile(self.request)

        c_user = usera.user_obj  #get_user_by_email(the_user(self.request))
        history_list_omf = Reservation.objects.filter(
            user_ref=c_user, username=usera.session_username)
        history_list_sim = SimReservation.objects.filter(
            user_ref=c_user, username=usera.session_username)
        context = super(SliceHistoryView, self).get_context_data(**kwargs)
        context['history_list_omf'] = history_list_omf
        context['history_list_sim'] = history_list_sim
        context['time_now'] = timezone.now
        context['title'] = 'Request Log'
        context['sim_enable'] = SIM_RESERVATION
        # the menu items on the top
        context['topmenu_items'] = topmenu_items(
            'Request Log', page.request)  # @qursaan change from _live
        # so we can sho who is logged
        context['username'] = usera.username  #the_user(self.request)
        prelude_env = page.prelude_env()
        context.update(prelude_env)
        return context
Exemple #9
0
    def get(self, request, state=None):
        env = self.default_env()

        if request.user.is_authenticated():
            env['person'] = self.request.user
            # user_query  = Query().get('user').select('user_hrn','parent_authority').filter_by('user_hrn','==','$user_hrn')
            # user_details = execute_query(self.request, user_query)
            # try:
            #     env['user_details'] = user_details[0]
            # except Exception,e:
            #     env['error'] = "Please check your Credentials"

            # try:
            #     user_local_query  = Query().get('local:user').select('config').filter_by('email','==',str(env['person']))
            #     user_local_details = execute_query(self.request, user_local_query)
            #     user_local = user_local_details[0]
            #     user_local_config = user_local['config']
            #     user_local_config = json.loads(user_local_config)
            #     user_local_authority = user_local_config.get('authority')
            #     if 'user_details' not in env or 'parent_authority' not in env['user_details'] or env['user_details']['parent_authority'] is None:
            #         env['user_details'] = {'parent_authority': user_local_authority}
            # except Exception,e:
            #     env['error'] = "Please check your Manifold user config"
            # ## check user is pi or not
            # platform_query  = Query().get('local:platform').select('platform_id','platform','gateway_type','disabled')
            # account_query  = Query().get('local:account').select('user_id','platform_id','auth_type','config')
            # platform_details = execute_query(self.request, platform_query)
            # account_details = execute_query(self.request, account_query)
            # for platform_detail in platform_details:
            #     for account_detail in account_details:
            #         if platform_detail['platform_id'] == account_detail['platform_id']:
            #             if 'config' in account_detail and account_detail['config'] is not '':
            #                 account_config = json.loads(account_detail['config'])
            #                 if 'myslice' in platform_detail['platform']:
            #                     acc_auth_cred = account_config.get('delegated_authority_credentials','N/A')
            # # assigning values
            # if acc_auth_cred == {}:
            #     pi = "is_not_pi"
            # else:
            #     pi = "is_pi"

        else:
            env['person'] = None

        env['theme'] = self.theme
        env['section'] = "Institution"
        # env['pi'] = pi
        env['username'] = the_user(request)
        env['topmenu_items'] = topmenu_items(None, request)
        env['servdirurl'] = self.server_url
        if state: env['state'] = state
        elif not env['username']: env['state'] = None
        # use one or two columns for the layout - not logged in users will see the login prompt
        env['layout_1_or_2'] = "layout-unfold2.html" if not env[
            'username'] else "layout-unfold1.html"

        return render_to_response(self.template,
                                  env,
                                  context_instance=RequestContext(request))
Exemple #10
0
 def _display(self, request, form):
     return render(
         request, 'contact-view.html', {
             'form': form,
             'topmenu_items': topmenu_items('Contact', request),
             'username': UserAccessProfile(request).username,
             'title': 'Contact Us',
         })
def scroll_view (request):
    return render_to_response ('view-scroll.html',
                               {'title':'Toy page for scrolling',
                                'topmenu_items': topmenu_items('scroll',request),
                                'username':the_user (request),
                                'lorem':lorem,
                                },
                               context_instance=RequestContext(request))
Exemple #12
0
def scroll_view(request):
    return render_to_response('view-scroll.html', {
        'title': 'Toy page for scrolling',
        'topmenu_items': topmenu_items('scroll', request),
        'username': the_user(request),
        'lorem': lorem,
    },
                              context_instance=RequestContext(request))
Exemple #13
0
    def get_or_post(self, request, method):
        user_a = UserAccessProfile(request)
        self.user_email = user_a.username  # the_user(request)
        page = Page(request)

        self.errors = []
        user_type = user_a.user_type  # get_user_type(user)
        if user_type != 0:
            messages.error(
                page.request,
                'Error: You have not permission to access this page.')
            return HttpResponseRedirect("/")

        # site = None
        try:
            site = Site.objects.get(id=1)
        except Site.DoesNotExist:
            site = None

        if site is None:
            site = Site(id=1)
            private_key, public_key = UserModules.create_keys()
            site.private_key = private_key
            site.public_key = public_key
            site.save()

        if method == 'POST':
            self.errors = []
            site_name = request.POST.get('site_name', None)
            site_url = request.POST.get('site_url', None)
            site_ip = request.POST.get('site_url', None)
            site_location = request.POST.get('site_location', None)
            site_contact = request.POST.get('site_contact', None)

            if not self.errors and site:
                site.name = site_name
                site.url = site_url
                site.ip = site_ip
                site.location = site_location
                site.contact_email = site_contact
                site.save()
                messages.success(request, 'Success: Update site information')

        template_name = "fed-site.html"
        template_env = {
            'topmenu_items': topmenu_items('Site Information', page.request),
            'username': user_a.username,  # the_user(self.request),
            'site_name': site.name,
            'site_url': site.url,
            'site_ip': site.ip,
            'site_location': site.location,
            'site_contact': site.contact_email,
            'site_pkey': site.public_key,
            'site_info': 1,
            'title': 'Site Information',
        }
        template_env.update(page.prelude_env())
        return render(request, template_name, template_env)
Exemple #14
0
    def get_context_data(self, **kwargs):
        # messages.info(self.request, 'You have logged in')
        page = Page(self.request)
        ctx_my_authorities = {}
        # The user need to be logged in
        usera = UserAccessProfile(self.request)
        if usera.username:
            user = usera.user_obj  # get_user_by_email(u_email=the_user(page.request))
            pi_authorities_tmp = Authority.objects.filter(
                authority_hrn=user.authority_hrn).all()
            pi_authorities = set()
            for pa in pi_authorities_tmp:
                # pi_authorities |= set(pa.authority_hrn) #['pi_authorities'])
                pi_authorities = pi_authorities.union([user.authority_hrn])

            pi_my_authorities = pi_authorities

            # Summary all
            # @qursaan
            # iterate on the requests and check if the authority matches a prefix startswith an authority on which the user is PI
            requests = get_requests()

            # requests = get_requests(queried_pending_authorities)
            for request in requests:
                auth_hrn = request['authority_hrn']
                if user.is_admin == 1 and auth_hrn:
                    for my_auth in pi_my_authorities:
                        if auth_hrn.startswith(my_auth):
                            # dest = ctx_my_authorities
                            request['allowed'] = 'allowed'

                if 'allowed' not in request:
                    request['allowed'] = 'denied'
                # print "authority for this request", auth_hrn

                if auth_hrn in pi_my_authorities:
                    # dest = ctx_my_authorities
                    if not auth_hrn in ctx_my_authorities:
                        ctx_my_authorities[auth_hrn] = []
                    ctx_my_authorities[auth_hrn].append(request)

        context = super(ValidatePendingView, self).get_context_data(**kwargs)
        context['my_authorities'] = ctx_my_authorities
        # context['sub_authorities']   = ctx_sub_authorities
        # context['delegation_authorities'] = ctx_delegation_authorities
        context['is_admin'] = user.is_admin
        # XXX This is repeated in all pages
        # more general variables expected in the template
        context['title'] = 'Validate Requests'
        # the menu items on the top
        context['topmenu_items'] = topmenu_items('Validation', page.request)
        # so we can sho who is logged
        context['username'] = usera.username

        # XXX We need to prepare the page for queries
        context.update(page.prelude_env())

        return context
Exemple #15
0
 def get (self, request, state=None):
     env = self.default_env()
     env['username']=the_user(request)
     env['topmenu_items'] = topmenu_items(None, request)
     if state: env['state'] = state
     elif not env['username']: env['state'] = None
     # use one or two columns for the layout - not logged in users will see the login prompt
     env['layout_1_or_2']="layout-unfold2.html" if not env['username'] else "layout-unfold1.html"
     return render_to_response('home-view.html',env, context_instance=RequestContext(request))
Exemple #16
0
    def get(self, request, state=None):
        env = self.default_env()

        email_list = []
        status_list = []
        authority_list = []
        config = {}

        user_query = Query().get('local:user').select('email', 'status',
                                                      'config')
        user_details = execute_admin_query(self.request, user_query)

        for user in user_details:
            # get email
            email_list.append(user['email'])
            # get status
            if user['status'] == 0:
                user_status = 'Disabled'
            elif user['status'] == 1:
                user_status = 'Validation Pending'
            elif user['status'] == 2:
                user_status = 'Enabled'
            else:
                user_status = 'N/A'

            status_list.append(user_status)
            #get authority
            if user['config'] is not None:
                user_config = json.loads(user['config'])
                user_authority = user_config.get('authority', 'N/A')
                authority_list.append(user_authority)

        user_list = [{
            'email': t[0],
            'status': t[1],
            'authority': t[2]
        } for t in zip(email_list, status_list, authority_list)]

        if request.user.is_authenticated():
            env['person'] = self.request.user
        else:
            env['person'] = None

        env['theme'] = self.theme
        env['user_list'] = user_list

        env['username'] = the_user(request)
        env['topmenu_items'] = topmenu_items(None, request)
        if state: env['state'] = state
        elif not env['username']: env['state'] = None
        # use one or two columns for the layout - not logged in users will see the login prompt
        env['layout_1_or_2'] = "layout-unfold2.html" if not env[
            'username'] else "layout-unfold1.html"

        return render_to_response(self.template,
                                  env,
                                  context_instance=RequestContext(request))
Exemple #17
0
 def get_context_data(self, **kwargs):
     page = Page(self.request)
     prelude_env = page.prelude_env()
     context = super(GraphicBuilderView, self).get_context_data(**kwargs)
     context['title'] = 'Graphic Builder Tools'
     # the menu items on the top
     context['topmenu_items'] = topmenu_items('Graphic Builder', page.request)  # @qursaan change from _live
     # so we can sho who is logged
     context['username'] = the_user(self.request)
     context.update(prelude_env)
     return context
Exemple #18
0
    def get_context_data(self, **kwargs):
        page = Page(self.request)

        #node_list = Node.objects.all()

        context = super(TimelineView, self).get_context_data(**kwargs)
        #context['node_list'] = node_list
        context['last_update'] = datetime.now()
        context['title'] = 'TIMELINE VIEW'
        context['username'] = UserAccessProfile(self.request).username
        context['topmenu_items'] = topmenu_items('Timeline View', page.request)
        prelude_env = page.prelude_env()
        context.update(prelude_env)
        return context
Exemple #19
0
def tab_view (request):
    logger.info("request {}".format(request.__class__))
    logger.info("{}".format(request))
    prelude=Prelude( js_files='js/bootstrap.js', css_files='css/bootstrap.css')

    tab_env = {'title':'Page for playing with Tabs',
               'topmenu_items': topmenu_items('tab',request),
               'username':the_user (request),
               'lorem': lorem,                                
               }

    tab_env.update (prelude.prelude_env())
    return render_to_response ('view-tab.html', tab_env,
                               context_instance=RequestContext(request))
Exemple #20
0
def tab_view (request):
    print "request", request.__class__
    print request
    prelude=Prelude( js_files='js/bootstrap.js', css_files='css/bootstrap.css')

    tab_env = {'title':'Page for playing with Tabs',
               'topmenu_items': topmenu_items('tab',request),
               'username':the_user (request),
               'lorem': lorem,                                
               }

    tab_env.update (prelude.prelude_env())
    return render_to_response ('view-tab.html', tab_env,
                               context_instance=RequestContext(request))
Exemple #21
0
 def _display (self, request, form):
     if request.user.is_authenticated():
         username = request.user.email
     else :
         username = None
         pi = "is_not_pi"
     return render(request, self.template, {
             'form': form,
             'topmenu_items': topmenu_items('Contact', request),
             'theme' : self.theme,
             'username': username,
             'section': "Contact",
             'request': request,
             })
Exemple #22
0
    def get_context_data(self, **kwargs):
        # We might have slices on different registries with different user accounts
        # We note that this portal could be specific to a given registry, to which we register users, but i'm not sure that simplifies things
        # Different registries mean different identities, unless we identify via SFA HRN or have associated the user email to a single hrn

        context = super(WebSockets2View, self).get_context_data(**kwargs)

        # XXX This is repeated in all pages
        # more general variables expected in the template
        context['title'] = 'SAMPLE WEBSOCKET PAGE',
        # the menu items on the top
        context['topmenu_items'] = topmenu_items('Dashboard', self.request)
        # so we can sho who is logged
        context['username'] = the_user(self.request)

        return context
Exemple #23
0
    def get_context_data(self, **kwargs):
        # We might have slices on different registries with different user accounts 
        # We note that this portal could be specific to a given registry, to which we register users, but i'm not sure that simplifies things
        # Different registries mean different identities, unless we identify via SFA HRN or have associated the user email to a single hrn

        context = super(WebSockets2View, self).get_context_data(**kwargs)

        # XXX This is repeated in all pages
        # more general variables expected in the template
        context['title'] = 'SAMPLE WEBSOCKET PAGE',
        # the menu items on the top
        context['topmenu_items'] = topmenu_items('Dashboard', self.request) 
        # so we can sho who is logged
        context['username'] = the_user(self.request) 

        return context
Exemple #24
0
    def get_or_post(self, request, method):
        usera = UserAccessProfile(request)
        self.user_email = usera.username  # the_user(request)
        page = Page(request)

        self.errors = []
        # user = get_user_by_email(the_user(self.request))
        user_type = usera.user_type  # get_user_type(user)
        if user_type != 0:
            messages.error(
                page.request,
                'Error: You have not permission to access this page.')
            return HttpResponseRedirect("/")

        fedlist = Site.objects.all()

        if method == 'POST':
            self.errors = []
            '''site_name = request.POST.get('site_name', '')
            site_url = request.POST.get('site_url', '')
            site_ip = request.POST.get('site_ip', '')
            site_location = request.POST.get('site_location', '')
            site_contact = request.POST.get('site_contact', '')

            if not self.errors and site:
                site.name = site_name
                site.url = site_url
                site.ip = site_ip
                site.location = site_location
                site.contact_email = site_contact
                site.save()
                messages.success(request, 'Success: Update site information')'''

        template_name = "fed-list.html"
        template_env = {
            'topmenu_items': topmenu_items('Site Information', page.request),
            'username': usera.username,  # the_user(self.request),
            'fedlist': fedlist,
            'title': 'Site Information',
        }
        template_env.update(page.prelude_env())
        return render(request, template_name, template_env)
Exemple #25
0
    def get_context_data(self, **kwargs):
        page = Page(self.request)
        n_local_user = MyUser.objects.filter().count()
        n_remote_user = '******'  # 'Users.objects.filter().count()
        n_remote_site = Site.objects.filter().count() - 1
        n_local_resources = PhysicalNode.objects.filter().count()
        n_remote_resources = '#'

        context = super(FedView, self).get_context_data(**kwargs)
        context['fed_service'] = get_fed_status()
        context['n_local_user'] = n_local_user
        context['n_remote_user'] = n_remote_user
        context['n_remote_site'] = n_remote_site
        context['n_local_res'] = n_local_resources
        context['n_remote_res'] = n_remote_resources
        context['username'] = UserAccessProfile(self.request).username  # the_user(self.request)
        context['topmenu_items'] = topmenu_items('Testbed View', page.request)
        prelude_env = page.prelude_env()
        context.update(prelude_env)
        return context
Exemple #26
0
    def get_or_post(self, request, method):
        page = Page(self.request)
        usera = UserAccessProfile(request)
        c_user = usera.user_obj  # get_user_by_email(the_user(self.request))
        user_type = usera.user_type  # get_user_type(c_user)
        if user_type != 3:
            # messages.error(page.request, 'Error: You have not permission to access this page.')
            return HttpResponseRedirect("/")

        template_name = "std-courses-view.html"
        add_all_courses_by_email(usera.username)
        courses_list = StudentCourses.objects.filter(students_ref=c_user)
        template_env = {
            'topmenu_items': topmenu_items('My Courses', page.request),
            'username': usera.username,  #the_user(self.request),
            'courses_list': courses_list,
            'title': 'My Courses',
        }
        template_env.update(page.prelude_env())
        return render(request, template_name, template_env)
Exemple #27
0
    def get_or_post(self, request, method):
        page = Page(self.request)
        usera = UserAccessProfile(request)
        c_user = usera.user_obj
        user_type = usera.user_type
        if user_type != 2:
            messages.error(page.request, 'Error: You have not permission to access this page.')
            return HttpResponseRedirect("/")

        template_name = "ins_students_manage.html"
        student_list = MyUser.objects.filter(supervisor_id=c_user.id, user_type=3)
        template_env = {
            'topmenu_items': topmenu_items('Students List', page.request),
            # 'errors': errors,
            'username': usera.username, #the_user(self.request),
            'student_list': student_list,
            'time_now': timezone.now,
            'title': 'Current Students',
        }
        template_env.update(page.prelude_env())
        return render(request, template_name, template_env)
    def get_or_post(self, request, method):
        page = Page(self.request)
        usera = UserAccessProfile(request)
        c_user = usera.user_obj  #get_user_by_email(the_user(self.request))
        user_type = usera.user_type  #get_user_type(c_user)
        if user_type != 3:
            # messages.error(page.request, 'Error: You have not permission to access this page.')
            return HttpResponseRedirect("/")

        template_name = "std-experiments-view.html"
        s_courses_list = StudentCourses.objects.filter(students_ref=c_user)

        c_ids = []

        for c in s_courses_list:
            c_ids.append(c.course_ref.id)

        courses_list = Course.objects.filter(id__in=c_ids)
        exp_list = Experiments.objects.filter(course_ref__in=courses_list,
                                              status=0)

        res_exp_list = Experiments.objects.filter(course_ref__in=courses_list)
        std_exp_list = StudentsExperiment.objects.filter(
            students_ref=c_user, experiment_ref__in=res_exp_list)

        res_std_list_id = []
        for s in std_exp_list:
            res_std_list_id.append(s.experiment_ref.id)

        exp_list = exp_list.exclude(id__in=res_std_list_id)

        template_env = {
            'topmenu_items': topmenu_items('My Courses', page.request),
            'username': usera.username,
            'exp_list': exp_list,
            'std_exp_list': std_exp_list,
            'title': 'My Courses',
        }
        template_env.update(page.prelude_env())
        return render(request, template_name, template_env)
Exemple #29
0
    def get(self, request, state=None):
        env = self.default_env()

        if request.user.is_authenticated():
            env['person'] = self.request.user
        else:
            env['person'] = None

        env['theme'] = self.theme
        env['section'] = "About"

        env['username'] = the_user(request)
        env['topmenu_items'] = topmenu_items(None, request)
        if state: env['state'] = state
        elif not env['username']: env['state'] = None
        # use one or two columns for the layout - not logged in users will see the login prompt
        env['layout_1_or_2'] = "layout-unfold2.html" if not env[
            'username'] else "layout-unfold1.html"

        return render_to_response(self.template,
                                  env,
                                  context_instance=RequestContext(request))
Exemple #30
0
    def get_or_post(self, request, method):
        page = Page(self.request)
        usera = UserAccessProfile(self.request)
        c_user = usera.user_obj # get_user_by_email(the_user(self.request))
        user_type = usera.user_type # get_user_type(c_user)
        if user_type > 3:
            messages.error(page.request, 'Error: You have not permission to access this page.')
            return HttpResponseRedirect("/")
        lib_list = None
        lib_name = request.POST.get('lib_name', '')
        lib_auth = request.POST.get('lib_auth', '')
        lib_type = request.POST.get('lib_type', '')
        lib_tag = request.POST.get('lib_tag', '')
        lib_desc = request.POST.get('lib_desc', '')

        if method == 'POST':
            lib_list = CustomLibrary.objects.filter(name__icontains=lib_name, author__icontains=lib_auth,
                                                    type__icontains=lib_type, tag__icontains=lib_tag,
                                                    description__icontains=lib_desc)

        else:
            lib_list = CustomLibrary.objects.all()

        template_name = "library-view.html"
        template_env = {
            'topmenu_items': topmenu_items('Library List', page.request),
            # 'errors': errors,
            'lib_list': lib_list,
            'lib_name': lib_name,
            'lib_auth': lib_auth,
            'lib_type': lib_type,
            'lib_tag': lib_tag,
            'lib_desc': lib_desc,
            'username': usera.username, # the_user(self.request),
            'title': 'Custom Libraries',
        }
        template_env.update(page.prelude_env())
        return render(request, template_name, template_env)
Exemple #31
0
    def get_context_data(self, **kwargs):

        page = Page(self.request)

        debug_platform = DebugPlatform(page=page)

        context = super(PlatformView, self).get_context_data(**kwargs)

        context['ALL_STATIC'] = "all_static"
        context['unfold_main'] = debug_platform.render(self.request)

        # XXX This is repeated in all pages
        # more general variables expected in the template
        context['title'] = 'Test view that combines various plugins'
        # the menu items on the top
        context['topmenu_items'] = topmenu_items('Dashboard', self.request)
        # so we can sho who is logged
        context['username'] = the_user(self.request)

        prelude_env = page.prelude_env()
        context.update(prelude_env)

        return context
Exemple #32
0
    def get_context_data(self, **kwargs):
        page = Page(self.request)

        the_date = datetime.now(tz=timezone.get_current_timezone())  # datetime.today()
        year_l, year_v = get_total_last_year(the_date, 't')
        year_vl, year_vv = get_total_last_year(the_date, 'v')
        year_sl, year_sv = get_total_last_year(the_date, 's')
        # user_list, value_list = get_month_usage_by_users(None)
        res_l , res_v, res_c = get_total_resource_usage()

        context = super(StatsAdminView, self).get_context_data(**kwargs)
        context['year_l'] = year_l
        context['year_vv'] = year_vv
        context['year_sv'] = year_sv
        context['year_v'] = year_v
        context['res_l'] = res_l
        context['res_v'] = res_v
        context['res_c'] = res_c
        context['username'] = UserAccessProfile(self.request).username  # the_user(self.request)
        context['topmenu_items'] = topmenu_items('Testbed View', page.request)
        prelude_env = page.prelude_env()
        context.update(prelude_env)
        return context
Exemple #33
0
    def get_context_data(self, **kwargs):

        page = Page(self.request)

        debug_platform = DebugPlatform(page = page)

        context = super(PlatformView, self).get_context_data(**kwargs)

        context['ALL_STATIC'] = "all_static"
        context['unfold_main'] = debug_platform.render(self.request)

        # XXX This is repeated in all pages
        # more general variables expected in the template
        context['title'] = 'Test view that combines various plugins'
        # the menu items on the top
        context['topmenu_items'] = topmenu_items('Dashboard', self.request) 
        # so we can sho who is logged
        context['username'] = the_user(self.request) 

        prelude_env = page.prelude_env()
        context.update(prelude_env)

        return context
    def render(self):
        template_env = {}
        
        # define 'unfold_main' to the template engine - the main contents
        template_env [ 'unfold_main' ] = "\n".join(self._content)

        # more general variables expected in the template
        template_env [ 'title' ] = 'Test view that combines various plugins'
        # the menu items on the top
        template_env [ 'topmenu_items' ] = topmenu_items('slice', self.request) 
        # so we can sho who is logged
        template_env [ 'username' ] = the_user (self.request) 

        # don't forget to run the requests
        # Jordan: it seems we need this to init plugins js
        # Issue a "manifold is not defined" error
        #self.expose_queries ()
        # Thierry: this is deprecated anyway, and will happen as part of prelude_env
        # "manifold not defined" would be due to a missing dependency to manifold.js or something...

        template_env.update(self.prelude_env())
        result=render_to_response ('view-unfold1.html',template_env,
                                   context_instance=RequestContext(self.request))
        return result
 def _display (self, request, form):
     return render(request, 'contact.html', {
             'form': form,
             'topmenu_items': topmenu_items('Contact', request),
             'username': the_user (request)
             })
 def _display (self, request):
     return render(request, 'documentationview.html', {
             'topmenu_items': topmenu_items('FAQ', request),
             })
Exemple #37
0
 def _display (self, request):
     return render(request, 'experimentview.html', {
             'topmenu_items': topmenu_items('experiment', request),
             })
 def _display (self, request):
     return render(request, 'supportview.html', {
             'topmenu_items': topmenu_items('support', request),
             })