lib/hatemile/implementation/accessible_form_implementation.rb
##
# Include the scripts used by solutions.
Include the scripts used by solutions.
Include the scripts used by solutions .
def generate_validation_scripts
        local = @parser.find('head,body').first_result
        unless local.nil?
          if @parser.find(
            "##{AccessibleEventImplementation::ID_SCRIPT_COMMON_FUNCTIONS}"
          ).first_result.nil?
            common_functions_script = @parser.create_element('script')
            common_functions_script.set_attribute(
              'id',
              AccessibleEventImplementation::ID_SCRIPT_COMMON_FUNCTIONS
            )
            common_functions_script.set_attribute('type', 'text/javascript')
            common_functions_script.append_text(
              File.read(
                File.join(
                  File.dirname(File.dirname(File.dirname(__FILE__))),
                  'js',
                  'common.js'
                )
              )
            )
            local.prepend_element(common_functions_script)
          end
        end
        @script_list_fields_with_validation = @parser.find(
          "##{ID_SCRIPT_LIST_VALIDATION_FIELDS}"
        ).first_result
        if @script_list_fields_with_validation.nil?
          @script_list_fields_with_validation = @parser.create_element('script')
          @script_list_fields_with_validation.set_attribute(
            'id',
            ID_SCRIPT_LIST_VALIDATION_FIELDS
          )
          @script_list_fields_with_validation.set_attribute(
            'type',
            'text/javascript'
          )
          @script_list_fields_with_validation.append_text(
            File.read(
              File.join(
                File.dirname(File.dirname(File.dirname(__FILE__))),
                'js',
                'scriptlist_validation_fields.js'
              )
            )
          )
          local.append_element(@script_list_fields_with_validation)
        end
        if @parser.find("##{ID_SCRIPT_EXECUTE_VALIDATION}").first_result.nil?
          script_function = @parser.create_element('script')
          script_function.set_attribute('id', ID_SCRIPT_EXECUTE_VALIDATION)
          script_function.set_attribute('type', 'text/javascript')
          script_function.append_text(
            File.read(
              File.join(
                File.dirname(File.dirname(File.dirname(__FILE__))),
                'js',
                'validation.js'
              )
            )
          )
          @parser.find('body').first_result.append_element(script_function)
        end
        @scripts_added = true
      end
def generate_validation_scripts local = @parser . find ( 'head,body' ) . first_result unless local . nil? if @parser . find ( "##{AccessibleEventImplementation::ID_SCRIPT_COMMON_FUNCTIONS}" ) . first_result . nil? common_functions_script = @parser . create_element ( 'script' ) common_functions_script . set_attribute ( 'id' , AccessibleEventImplementation :: ID_SCRIPT_COMMON_FUNCTIONS ) common_functions_script . set_attribute ( 'type' , 'text/javascript' ) common_functions_script . append_text ( File . read ( File . join ( File . dirname ( File . dirname ( File . dirname ( __FILE__ ) ) ) , 'js' , 'common.js' ) ) ) local . prepend_element ( common_functions_script ) end end @script_list_fields_with_validation = @parser . find ( "##{ID_SCRIPT_LIST_VALIDATION_FIELDS}" ) . first_result if @script_list_fields_with_validation . nil? @script_list_fields_with_validation = @parser . create_element ( 'script' ) @script_list_fields_with_validation . set_attribute ( 'id' , ID_SCRIPT_LIST_VALIDATION_FIELDS ) @script_list_fields_with_validation . set_attribute ( 'type' , 'text/javascript' ) @script_list_fields_with_validation . append_text ( File . read ( File . join ( File . dirname ( File . dirname ( File . dirname ( __FILE__ ) ) ) , 'js' , 'scriptlist_validation_fields.js' ) ) ) local . append_element ( @script_list_fields_with_validation ) end if @parser . find ( "##{ID_SCRIPT_EXECUTE_VALIDATION}" ) . first_result . nil? script_function = @parser . create_element ( 'script' ) script_function . set_attribute ( 'id' , ID_SCRIPT_EXECUTE_VALIDATION ) script_function . set_attribute ( 'type' , 'text/javascript' ) script_function . append_text ( File . read ( File . join ( File . dirname ( File . dirname ( File . dirname ( __FILE__ ) ) ) , 'js' , 'validation.js' ) ) ) @parser . find ( 'body' ) . first_result . append_element ( script_function ) end @scripts_added = true end
Include the scripts used by solutions.
Include the scripts used by solutions .