Include the scripts used by solutions.

def _generate_validation_scripts(self):
        """
        Include the scripts used by solutions.
        """

        id_script_list_validation_fields = (
            AccessibleFormImplementation.ID_SCRIPT_LIST_VALIDATION_FIELDS
        )
        local = self.parser.find('head,body').first_result()
        if local is not None:
            if (
                self.parser.find(
                    '#'
                    + AccessibleEventImplementation.ID_SCRIPT_COMMON_FUNCTIONS
                ).first_result() is None
            ):
                common_functions_file = open(
                    os.path.join(
                        os.path.dirname(os.path.dirname(os.path.dirname(
                            os.path.realpath(__file__)
                        ))),
                        'js',
                        'common.js'
                    ),
                    'r'
                )
                common_functions_content = common_functions_file.read()
                common_functions_file.close()

                common_functions_script = self.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(common_functions_content)
                local.prepend_element(common_functions_script)

            self.script_list_fields_with_validation = self.parser.find(
                '#'
                + id_script_list_validation_fields
            ).first_result()
            if self.script_list_fields_with_validation is None:
                script_list_file = open(
                    os.path.join(
                        os.path.dirname(os.path.dirname(os.path.dirname(
                            os.path.realpath(__file__)
                        ))),
                        'js',
                        'scriptlist_validation_fields.js'
                    ),
                    'r'
                )
                script_list_content = script_list_file.read()
                script_list_file.close()

                self.script_list_fields_with_validation = (
                    self.parser.create_element('script')
                )
                self.script_list_fields_with_validation.set_attribute(
                    'id',
                    id_script_list_validation_fields
                )
                self.script_list_fields_with_validation.set_attribute(
                    'type',
                    'text/javascript'
                )
                self.script_list_fields_with_validation.append_text(
                    script_list_content
                )
                local.append_element(self.script_list_fields_with_validation)
            if (
                self.parser.find(
                    '#'
                    + AccessibleFormImplementation.ID_SCRIPT_EXECUTE_VALIDATION
                ).first_result() is None
            ):
                script_function_file = open(
                    os.path.join(
                        os.path.dirname(os.path.dirname(os.path.dirname(
                            os.path.realpath(__file__)
                        ))),
                        'js',
                        'validation.js'
                    ),
                    'r'
                )
                script_function_content = script_function_file.read()
                script_function_file.close()

                script_function = self.parser.create_element('script')
                script_function.set_attribute(
                    'id',
                    AccessibleFormImplementation.ID_SCRIPT_EXECUTE_VALIDATION
                )
                script_function.set_attribute('type', 'text/javascript')
                script_function.append_text(script_function_content)
                self.parser.find('body').first_result().append_element(
                    script_function
                )
        self.scripts_added = True