Пример #1
0
def exampleGroup(request, example_group_slug):
   example_group   = ExampleGroup.objects.get(slug=example_group_slug)
   
   rule_categories = RuleCategory.objects.all().order_by('order')
   rule_category   = example_group.rule_category

   title = example_group.title_text

   request.session['oaa_bread_crumb_2_title'] = title
   request.session['oaa_bread_crumb_2_url']   = reverse('show_examples_for_example_group', args=(example_group.slug,))
   request.session['oaa_bread_crumb_3_title'] = ''
   request.session['oaa_bread_crumb_3_url']   = ''

   request.session['oaa_main_examples_url']  = reverse('show_examples_for_example_group', args=(example_group.slug,)) 
   request.session['oaa_main_examples_opt']  = example_group.slug
      
   return render_to_response('examples/example_group.html',{
      'website'         : "OAA Example Group: " + title,
      'title'           : title,
      'main'            : 'examples',
      'option'          : rule_category.slug,
      'rule_category'   : rule_category,
      'rule_categories' : rule_categories,
      'example_group'   : example_group,
      'bread_crumbs'    : breadCrumbs(request),
   },context_instance=RequestContext(request))
Пример #2
0
def specfication(request, url_slug):
   spec  = LanguageSpec.objects.get(url_slug=url_slug)
   specs = LanguageSpec.objects.all()
   
   element_definitions = []
   
   for ed in spec.element_definitions.all():
     if ed.has_examples() or ed.has_rules(): 
       element_definitions.append(ed)
       
   request.session['oaa_bread_crumb_1_title'] = spec.abbr
   request.session['oaa_bread_crumb_1_url']   = reverse('show_markup', args=(spec.url_slug,) )
   request.session['oaa_bread_crumb_2_title'] = ''
   request.session['oaa_bread_crumb_2_url']   = ''
   request.session['oaa_bread_crumb_3_title'] = ''
   request.session['oaa_bread_crumb_3_url']   = ''       

   request.session['oaa_main_markup_url'] = reverse('show_markup', args=(spec.url_slug,) )
   request.session['oaa_main_markup_opt'] = spec.url_slug
       
   
   return render_to_response('markup/specification.html',{
      'website'  : 'OAA Specification: ' + spec.title,
      'title'    : 'Specification: ' + spec.title,
      'main'     : 'markup',
      'option'   : spec.url_slug,
      'specs'    : specs,
      'spec'     : spec,
      'element_definitions' : element_definitions,
      'bread_crumbs'  : breadCrumbs(request),
   },context_instance=RequestContext(request))
Пример #3
0
def home(request):
   about = About.objects.get(about_slug='home')

   request.session['oaa_bread_crumb_1_title'] = 'Home'
   request.session['oaa_bread_crumb_1_url']   = reverse('show_home')
   request.session['oaa_bread_crumb_2_title'] = ''
   request.session['oaa_bread_crumb_2_url']   = ''
   request.session['oaa_bread_crumb_3_title'] = ''
   request.session['oaa_bread_crumb_3_url']   = ''

   return render_to_response('abouts/home.html',{
      'title'         : about.title_text,
      'main'          : 'home',
      'about'         : about,
      'bread_crumbs'  : breadCrumbs(request),
   },context_instance=RequestContext(request))
Пример #4
0
def examplePermanent(request, example_slug):
   example  = Example.objects.get(permanent_slug=example_slug)
   
   rule_categories = RuleCategory.objects.all().order_by('order')

   request.session['oaa_bread_crumb_3_title'] = "Example " + example.id
   request.session['oaa_bread_crumb_3_url']   = reverse('show_example', args=(example.example_id,))
     
   return render_to_response('examples/example.html',{
      'website'         : 'OAA Example: ' + example.title_text,
      'title'           : 'Example: ' + example.title_html,
      'main'            : 'examples',
      'option'          : request.session['oaa_main_examples_opt'],
      'example'         : example,
      'rule_categories' : rule_categories,
      'bread_crumbs'    : breadCrumbs(request),
   },context_instance=RequestContext(request))# Create your views here.
Пример #5
0
def rule(request, rule_id):
   rulesets        = Ruleset.objects.all()
   rule            = Rule.objects.get(rule_id=rule_id)

   request.session['oaa_bread_crumb_2_title'] = rule.nls_rule_id
   request.session['oaa_bread_crumb_2_url']   = reverse('show_rule', args=(rule.rule_id,))
   request.session['oaa_bread_crumb_3_title'] = ''
   request.session['oaa_bread_crumb_3_url']   = ''
   
   return render_to_response('rulesets/rule.html',{
      'website'         : "OAA Rule: " + rule.summary_text,
      'title'           : "Rule: " + rule.summary_html,
      'main'            : 'ruleset',
      'rulesets'        : rulesets,
      'option'          : request.session['oaa_main_rulesets_opt'],
      'rule'            : rule,
      'bread_crumbs'    : breadCrumbs(request),
   },context_instance=RequestContext(request))# Create your views here.
Пример #6
0
def example(request, example_id):
   example  = Example.objects.get(example_id=example_id)
   
   rule_categories = RuleCategory.objects.all().order_by('order')

   title = example.title_text

   request.session['oaa_bread_crumb_3_title'] = title 
   request.session['oaa_bread_crumb_3_url']   = reverse('show_example', args=(example.example_id,))
     
   return render_to_response('examples/example.html',{
      'website'         : "OAA Example: " + title,
      'title'           : title,
      'main'            : "examples",
      'option'          : request.session['oaa_main_examples_opt'],
      'example'         : example,
      'rule_categories' : rule_categories,
      'bread_crumbs'    : breadCrumbs(request),
   },context_instance=RequestContext(request))# Create your views here.
Пример #7
0
def about(request, about_slug):
   about  = About.objects.get(about_slug=about_slug)
   abouts = About.objects.all()

   request.session['oaa_bread_crumb_1_title'] = about.title_text
   request.session['oaa_bread_crumb_1_url']   = about.get_absolute_url()
   request.session['oaa_bread_crumb_2_title'] = ''
   request.session['oaa_bread_crumb_2_url']   = ''
   request.session['oaa_bread_crumb_3_title'] = ''
   request.session['oaa_bread_crumb_3_url']   = ''

   request.session['oaa_main_abouts_url']     = about.get_absolute_url()      
   
   return render_to_response('abouts/about.html',{
      'title'        : about.title_text,
      'main'         : 'abouts',
      'about'        : about,
      'abouts'       : abouts,
      'bread_crumbs' : breadCrumbs(request),
   },context_instance=RequestContext(request))
Пример #8
0
def ruleCategories(request):
   rule_categories = RuleCategory.objects.all().order_by('order')

   request.session['oaa_bread_crumb_1_title'] = 'Summary'
   request.session['oaa_bread_crumb_1_url']   = reverse('show_examples')
   request.session['oaa_bread_crumb_2_title'] = ''
   request.session['oaa_bread_crumb_2_url']   = ''
   request.session['oaa_bread_crumb_3_title'] = ''
   request.session['oaa_bread_crumb_3_url']   = ''

   request.session['oaa_main_examples_url']  = reverse('show_examples') 
   request.session['oaa_main_examples_opt']  = 'examples' 
      
   return render_to_response('examples/rule_categories.html',{
      'title'           : 'Summary of Examples by Rule Categories',
      'main'            : 'examples',
      'option'          : 'summary',
      'rule_categories' : rule_categories,
      'bread_crumbs'    : breadCrumbs(request),
   },context_instance=RequestContext(request))
Пример #9
0
def tool(request, tool_slug):
   tool  = Tool.objects.get(tool_slug=tool_slug)
   tools = Tool.objects.all()

   request.session['oaa_bread_crumb_1_title'] = tool.title
   request.session['oaa_bread_crumb_1_url']   = reverse('show_tool', args=(tool.tool_slug,))   
   request.session['oaa_bread_crumb_2_title'] = ''
   request.session['oaa_bread_crumb_2_url']   = ''
   request.session['oaa_bread_crumb_3_title'] = ''
   request.session['oaa_bread_crumb_3_url']   = ''      

   request.session['oaa_main_tools_url'] = reverse('show_tool', args=(tool.tool_slug,))   
      
   return render_to_response('tools/tool.html',{
      'title'        : tool.title,
      'main'         : 'tools',
      'tool'         : tool,
      'tools'        : tools,
      'bread_crumbs' : breadCrumbs(request),
   },context_instance=RequestContext(request))
Пример #10
0
def home(request):
   about = About.objects.get(about_slug='home')
   examples = Example.objects.all()
   defs = ElementDefinition.objects.all()

   request.session['oaa_bread_crumb_1_title'] = 'Home'
   request.session['oaa_bread_crumb_1_url']   = reverse('show_home')
   request.session['oaa_bread_crumb_2_title'] = ''
   request.session['oaa_bread_crumb_2_url']   = ''
   request.session['oaa_bread_crumb_3_title'] = ''
   request.session['oaa_bread_crumb_3_url']   = ''

   return render_to_response('home.html',{
      'title'         : about.title_text,
      'main'          : 'home',
      'about'         : about,
      'bread_crumbs'  : breadCrumbs(request),
      'examples'      : examples,
      'defs'          : defs,
   },context_instance=RequestContext(request))
Пример #11
0
def wcag20(request):
   rulesets          = Ruleset.objects.all()

   ruleset_by_guidelines = RulesetMappingsByGuidelines(Ruleset.objects.all())
   
   for g in WCAG20_Guideline.objects.all():
     rm_for_g = RulesetMappingsByGuideline(g)
     for sc in g.success_criteria.all():
       rm_for_sc = RulesetMappingsBySuccessCriterion(sc)
       for r in sc.rules.all():
         rm_for_r = RulesetMappingsByRule(r)
         rm_for_sc.has_rules = True
         for rs in ruleset_by_guidelines.rulesets.all():
           try:
             rm = rs.rule_mappings.get(rule=r)
             mapping = RulesetMapping(True, rm.required)  
           except ObjectDoesNotExist:
             mapping = RulesetMapping(False, False) 
           rm_for_r.ruleset_info.append(mapping)       
         rm_for_sc.rule_info.append(rm_for_r)
       rm_for_g.success_criterion_info.append(rm_for_sc)
     ruleset_by_guidelines.guideline_info.append(rm_for_g)

   request.session['oaa_bread_crumb_1_title'] = 'WCAG 2.0'
   request.session['oaa_bread_crumb_1_url']   = reverse('show_rulesets_wcag20')
   request.session['oaa_bread_crumb_2_title'] = ''
   request.session['oaa_bread_crumb_2_url']   = ''
   request.session['oaa_bread_crumb_3_title'] = ''
   request.session['oaa_bread_crumb_3_url']   = ''
   
   request.session['oaa_main_rulesets_url']   = reverse('show_rulesets_wcag20')
   request.session['oaa_main_rulesets_opt']   = 'wcag20'
   
   return render_to_response('rulesets/wcag20.html',{
      'title'                 : 'Compare Rulesets by WCAG 2.0 Guidelines',
      'main'                  : 'rulesets',
      'rulesets'              : rulesets,
      'option'                : request.session['oaa_main_rulesets_opt'],
      'ruleset_by_guidelines' : ruleset_by_guidelines,
      'bread_crumbs'          : breadCrumbs(request)
   },context_instance=RequestContext(request))
Пример #12
0
def ruleset(request, ruleset_slug):
   ruleset           = Ruleset.objects.get(slug=ruleset_slug)
   rulesets          = Ruleset.objects.all()
   
   required_rules    = RuleMapping.objects.filter(ruleset=ruleset, required=True)
   recommended_rules = RuleMapping.objects.filter(ruleset=ruleset, required=False)
      
   rule_mappings_by_categories = []
   
   for rc in RuleCategory.objects.all():
     rm_for_rc = RuleMappingsForRuleCategory(rc)
     for rm in RuleMapping.objects.filter(ruleset=ruleset, rule__rule_category=rc).order_by('rule__wcag_primary__level', 'rule__wcag_primary__guideline__principle__num', 'rule__wcag_primary__guideline__num', 'rule__wcag_primary__num', '-required'):     
       rm_for_rc.rule_mappings.append(rm)
          
     rule_mappings_by_categories.append(rm_for_rc)     

   request.session['oaa_bread_crumb_1_title'] = ruleset.title_text
   request.session['oaa_bread_crumb_1_url']   = reverse('show_ruleset', args=(ruleset.slug,))
   request.session['oaa_bread_crumb_2_title'] = ''
   request.session['oaa_bread_crumb_2_url']   = ''
   request.session['oaa_bread_crumb_3_title'] = ''
   request.session['oaa_bread_crumb_3_url']   = ''
     
   
   request.session['oaa_main_rulesets_url'] = reverse('show_ruleset', args=(ruleset.slug,))   
   request.session['oaa_main_rulesets_opt'] = ruleset.slug   


   return render_to_response('rulesets/ruleset.html',{
      'website'           : 'OAA Ruleset: ' + ruleset.title,
      'title'             : 'Ruleset: ' + ruleset.title,
      'main'              : 'rulesets',
      'option'            : request.session['oaa_main_rulesets_opt'],
      'rulesets'          : rulesets,
      'required_rules'    : required_rules,
      'recommended_rules' : recommended_rules,
      'rule_mappings_by_categories' : rule_mappings_by_categories,
      'bread_crumbs'      : breadCrumbs(request),
   },context_instance=RequestContext(request))
Пример #13
0
def rule_category(request):
   rulesets          = Ruleset.objects.all()
   
   ruleset_by_rule_category = RulesetMappingsByRuleCategories(Ruleset.objects.all())
   
   for rc in RuleCategory.objects.all():
     rm_for_rc = RulesetMappingsByRuleCategory(rc)
     for r in rc.rules.all().order_by('wcag_primary__level', 'wcag_primary__guideline__principle__num', 'wcag_primary__guideline__num', 'wcag_primary__num'):
       rm_for_r = RulesetMappingsByRule(r)
       rm_for_rc.has_rules = True
       for rs in ruleset_by_rule_category.rulesets.all():
         try:
           rm = rs.rule_mappings.get(rule=r)
           mapping = RulesetMapping(True, rm.required)  
         except ObjectDoesNotExist:
           mapping = RulesetMapping(False, False)  
         rm_for_r.ruleset_info.append(mapping)       
       rm_for_rc.rule_info.append(rm_for_r)
     ruleset_by_rule_category.rule_category_info.append(rm_for_rc)
     
   request.session['oaa_bread_crumb_1_title'] = 'Rule categories'
   request.session['oaa_bread_crumb_1_url']   = reverse('show_rulesets_rule_category')
   request.session['oaa_bread_crumb_2_title'] = ''
   request.session['oaa_bread_crumb_2_url']   = ''
   request.session['oaa_bread_crumb_3_title'] = ''
   request.session['oaa_bread_crumb_3_url']   = ''
     
   request.session['oaa_main_rulesets_url'] = reverse('show_rulesets_rule_category')
   request.session['oaa_main_rulesets_opt'] = 'compare'
      
   return render_to_response('rulesets/rule_categories.html',{
      'title'                    : 'Compare Rulesets by Rule Categories',
      'main'                     : 'rulesets',
      'rulesets'                 : rulesets,
      'option'                   : request.session['oaa_main_rulesets_opt'],
      'ruleset_by_rule_category' : ruleset_by_rule_category,
      'bread_crumbs'             : breadCrumbs(request),
   },context_instance=RequestContext(request))
Пример #14
0
def ruleCategory(request, rule_category_slug):
   rule_category   = RuleCategory.objects.get(slug=rule_category_slug)
   rule_categories = RuleCategory.objects.all().order_by('order')

   title = rule_category.title + " Example Groups" 

   request.session['oaa_bread_crumb_1_title'] = title
   request.session['oaa_bread_crumb_1_url']   = reverse('show_examples_for_rule_category', args=(rule_category.slug,))
   request.session['oaa_bread_crumb_2_title'] = ''
   request.session['oaa_bread_crumb_2_url']   = ''
   request.session['oaa_bread_crumb_3_title'] = ''
   request.session['oaa_bread_crumb_3_url']   = ''

   request.session['oaa_main_examples_url']  = reverse('show_examples_for_rule_category', args=(rule_category.slug,)) 
   request.session['oaa_main_examples_opt']  = rule_category.slug
      
   return render_to_response('examples/rule_category.html',{
      'title'           : title,
      'main'            : 'examples',
      'option'          : rule_category.slug,
      'rule_category'   : rule_category,
      'rule_categories' : rule_categories,
      'bread_crumbs'    : breadCrumbs(request),
   },context_instance=RequestContext(request))
Пример #15
0
def scope(request):
   rulesets = Ruleset.objects.all()

   element_rules = Rule.objects.filter(scope='1').order_by('wcag_primary__guideline__principle__num', 'wcag_primary__guideline__num', 'wcag_primary__num')
   
   element_rule_mappings = []
   for r in element_rules.all():
     rm_for_r = RulesetMappingsByRule(r)
     for rs in rulesets.all():
       try:
         rm = rs.rule_mappings.get(rule=r)
         mapping = RulesetMapping(True, rm.required)  
       except ObjectDoesNotExist:
         mapping = RulesetMapping(False, False)  
       rm_for_r.ruleset_info.append(mapping)       
     element_rule_mappings.append(rm_for_r)

   page_rules    = Rule.objects.filter(scope='2').order_by('wcag_primary__guideline__principle__num', 'wcag_primary__guideline__num', 'wcag_primary__num')

   page_rule_mappings = []
   for r in page_rules.all():
     rm_for_r = RulesetMappingsByRule(r)
     for rs in rulesets.all():
       try:
         rm = rs.rule_mappings.get(rule=r)
         mapping = RulesetMapping(True, rm.required)  
       except ObjectDoesNotExist:
         mapping = RulesetMapping(False, False)  
       rm_for_r.ruleset_info.append(mapping)       
     page_rule_mappings.append(rm_for_r)
   
   website_rules = Rule.objects.filter(scope='3').order_by('wcag_primary__guideline__principle__num', 'wcag_primary__guideline__num', 'wcag_primary__num')

   website_rule_mappings = []
   for r in website_rules.all():
     rm_for_r = RulesetMappingsByRule(r)
     for rs in rulesets.all():
       try:
         rm = rs.rule_mappings.get(rule=r)
         mapping = RulesetMapping(True, rm.required)  
       except ObjectDoesNotExist:
         mapping = RulesetMapping(False, False)  
       rm_for_r.ruleset_info.append(mapping)       
     website_rule_mappings.append(rm_for_r)

   request.session['oaa_bread_crumb_1_title'] = 'Rule scope'
   request.session['oaa_bread_crumb_1_url']   = reverse('show_rulesets_scope')
   request.session['oaa_bread_crumb_2_title'] = ''
   request.session['oaa_bread_crumb_2_url']   = ''
   request.session['oaa_bread_crumb_3_title'] = ''
   request.session['oaa_bread_crumb_3_url']   = ''
    
   request.session['oaa_main_rulesets_url'] = reverse('show_rulesets_scope')
   request.session['oaa_main_rulesets_opt'] = 'scope'
   
   return render_to_response('rulesets/scope.html',{
      'title'                 : 'Rules by Rule Scope',
      'main'                  : 'rulesets',
      'rulesets'              : rulesets,
      'option'                : request.session['oaa_main_rulesets_opt'],
      'element_rule_mappings' : element_rule_mappings,
      'page_rule_mappings'    : page_rule_mappings,
      'website_rule_mappings' : website_rule_mappings,
      'website_rules'         : website_rules,
      'bread_crumbs'          : breadCrumbs(request),
   },context_instance=RequestContext(request))