Setting the Coversheet and ProjectNarrative details according the
Questionnaire Answers.
189500
private void setQuestionnaireAnswers(CoverSheet coverSheet,
			ProjectNarrative projectNarrative) {
		List<? extends AnswerContract> answers = getPropDevQuestionAnswerService().getQuestionnaireAnswers(pdDoc.getDevelopmentProposal().getProposalNumber(),getNamespace(),getFormName());
		for (AnswerContract answer : answers) {
			Integer seqId = getQuestionAnswerService().findQuestionById(answer.getQuestionId()).getQuestionSeqId();
            switch (seqId) {
			case PRELIMINARY:
				YesNoNotApplicableDataType.Enum yesNoNotApplicableDataType = YesNoNotApplicableDataType.N_NO;
				if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) {
					yesNoNotApplicableDataType = YesNoNotApplicableDataType.Y_YES;
				} else if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) {
					yesNoNotApplicableDataType = YesNoNotApplicableDataType.N_NO;
				} else if (QUESTIONNAIRE_ANSWER_X.equals(answer.getAnswer())) {
					yesNoNotApplicableDataType = YesNoNotApplicableDataType.NA_NOT_APPLICABLE;
				}
				coverSheet.setCheckFullApp(yesNoNotApplicableDataType);
				break;
			case MERIT_REVIEW:
				if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) {
					projectNarrative
							.setCheckMeritReview(YesNoNotApplicableDataType.Y_YES);
				} else if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) {
					projectNarrative
							.setCheckMeritReview(YesNoNotApplicableDataType.N_NO);
				} else if (QUESTIONNAIRE_ANSWER_X.equals(answer.getAnswer())) {
					projectNarrative
							.setCheckMeritReview(YesNoNotApplicableDataType.NA_NOT_APPLICABLE);
				}
				break;

			case MENTORING:
				if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) {
					projectNarrative
							.setCheckMentoring(YesNoNotApplicableDataType.Y_YES);
				} else if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) {
					projectNarrative
							.setCheckMentoring(YesNoNotApplicableDataType.N_NO);
				}
				break;

			case PRIOR_SUPPORT:
				// Does narrative include info regarding prior support?
				if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer()))
					projectNarrative
							.setCheckPriorSupport(YesNoNotApplicableDataType.Y_YES);
				if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer()))
					projectNarrative
							.setCheckPriorSupport(YesNoNotApplicableDataType.N_NO);
				if (QUESTIONNAIRE_ANSWER_X.equals(answer.getAnswer()))
					projectNarrative
							.setCheckPriorSupport(YesNoNotApplicableDataType.NA_NOT_APPLICABLE);
				break;
			case HR_QUESTION:
				/*
				 * HR Info that is mandatory for renwals from academic
				 * institutions.
				 */
				if (QUESTIONNAIRE_ANSWER_NO.equals(answer.getAnswer())) {
					projectNarrative
							.setCheckHRInfo(YesNoNotApplicableDataType.N_NO);
				}
				break;
			case HR_REQUIRED_INFO:
				/*
				 * HR Info that is mandatory for renwals from academic
				 * institutions.
				 */
				if (QUESTIONNAIRE_ANSWER_YES.equals(answer.getAnswer())) {
					projectNarrative
							.setCheckHRInfo(YesNoNotApplicableDataType.Y_YES);
				}
				break;
			default:
				break;
			}
		}
	}
453984
public function answerImportAction()
    {
        $controller   = 'answers';
        $importLoader = $this->loader->getImportLoader();

        $params['defaultImportTranslator'] = $importLoader->getDefaultTranslator($controller);
        $params['formatBoxClass']          = 'browser table';
        $params['importer']                = $importLoader->getImporter($controller);
        $params['importLoader']            = $importLoader;
        $params['tempDirectory']           = $importLoader->getTempDirectory();
        $params['importTranslators']       = $importLoader->getTranslators($controller);

        $this->addSnippets('Survey_AnswerImportSnippet', $params);
    }
14695
private function detailed()
    {
        if (!$this->done && in_array('--detailed-report', $this->params)) {
            $this->done = true;
            $details = $this->getDetailsForUser(!in_array('--open-out', $this->params));
            if ($details !== false) {
                $counterReport = \common_report_Report::createInfo('Detailed report for the user');
                $helper = new ConsoleTableHelper();
                $helper->addHeader(['TestTaker', 'Deliveries', 'Executions']);
                $helper->addRows($details);
                $counterReport->add($helper->generateReport());
                $this->report->add($counterReport);
            }
        }
    }
1226176
def process_question(self):
        
        image_files = []
        question_data = json.loads(self.raw_data)

        # process urls for widgets
        self._recursive_url_find(question_data, image_files)

        # Process question
        if 'question' in question_data and 'images' in question_data['question']:
            question_data['question']['images'], qfiles = self.process_image_field(question_data['question'])
            image_files += qfiles

        # Process hints
        if 'hints' in question_data:
            for hint in question_data['hints']:
                if 'images' in hint:
                    hint['images'], hfiles = self.process_image_field(hint)
                    image_files += hfiles

        # Process answers
        if 'answers' in question_data:
            for answer in question_data['answers']:
                if 'images' in answer:
                    answer['images'], afiles = self.process_image_field(answer)
                    image_files += afiles

        # Process raw data
        self.raw_data = json.dumps(question_data, ensure_ascii=False)
        # Assume no need for special HTML processing for Persues questions
        # This avoids probelms with questions that contain < and > inequalities
        # in formulas that get erroneously parsed as HTML tags
        self.raw_data, data_files = super(PerseusQuestion, self).set_images(self.raw_data, parse_html=False)

        # Combine all files processed
        self.files = image_files + data_files

        # Return all filenames
        return [f.filename for f in self.files]
658866
protected function prepareForResponse()
    {
        if ($this->preparedForResponse) {
            return;
        }

        $this->loadView();
        $this->loadThemer();
        $this->loadThemerDefaultFiles($this->config);
        $this->loadGlobalViewVariables($this->config);

        if (method_exists($this, 'prepareExtraForResponse')) {
            $this->prepareExtraForResponse();
        }

        $this->preparedForResponse = true;
    }
967862
def _setup_parameters(self):
        
        # facet
        self.facet.set(
            layout=self.layout,
            theme=self.theme,
            coordinates=self.coordinates,
            figure=self.figure,
            axs=self.axs
        )

        # layout
        self.layout.axs = self.axs
        # theme
        self.theme.figure = self.figure
788420
public function editSettings()
    {
        $this->setTitleEditSettings();
        $this->setBreadcrumbEditSettings();

        $this->setData('settings', $this->getModuleSettings('xss'));

        $this->submitSettings();
        $this->setDataEditSettings();
        $this->outputEditSettings();
    }
749911
def run_section(self, name, input_func=_stdin_):
        """"""
        print('\nStuff %s by the license:\n' % name)
        section = self.survey[name]
        for question in section:
            self.run_question(question, input_func)
1124804
function () {
      var done = this.async();
      var questions = [];

      // Project name
      if (typeof this.preset.name === 'undefined' || this.preset.name === '') {
        questions.push({
          type: 'input',
          name: 'name',
          message: 'Project Name',
          default: this.settings.name || _s.titleize(this.appname)
        });
      }

      // Feature options
      options.forEach(function (option) {
        var question;
        var name = option.name;
        var type = option.type;
        if (typeof this.preset[name] === 'undefined') {
          switch (type) {
            case 'list':
              question = _.pick(option, 'name', 'message', 'type');
              question.choices = _.map(option.choices, function (choice) {
                var data = _.pick(choice, 'name', 'value', 'disabled');
                return data;
              }.bind(this));
              question.default = this.settings[name];
              break;
            case 'checkbox':
              question = _.pick(option, 'name', 'message', 'type', 'validate');
              question.choices = _.map(option.choices, function (choice) {
                var data = _.pick(choice, 'name', 'value', 'disabled');
                data.checked = _.includes(this.settings[name], data.value);
                return data;
              }.bind(this));
              break;
          }
          questions.push(question);
        }
      }.bind(this));

      // Save config or not
      if (this.configType === 'custom') {
        questions.push({
          type: 'confirm',
          name: 'store',
          message: 'Do you want to save this config to .yo-rc.json?',
          default: false
        });
      }

      this.prompt(questions, function (answers) {
        // Finalize generator settings
        this.settings.name = typeof answers.name !== 'undefined' ? answers.name : this.preset.name;
        this.store = answers.store || false;
        options.forEach(function (option) {
          var name = option.name;
          this.settings[name] = answers[name] || this.preset[name];
        }.bind(this));

        done();
      }.bind(this));
    }
378207
protected function define_settings() {
        global $CFG;
        require_once($CFG->libdir.'/questionlib.php');

        // All the settings related to this activity will include this prefix
        $settingprefix = $this->modulename . '_' . $this->moduleid . '_';

        // All these are common settings to be shared by all activities

        // Define activity_include (to decide if the whole task must be really executed)
        // Dependent of:
        // - activities root setting
        // - section_included setting (if exists)
        $settingname = $settingprefix . 'included';
        $activity_included = new backup_activity_generic_setting($settingname, base_setting::IS_BOOLEAN, true);
        $activity_included->get_ui()->set_icon(new image_icon('icon', get_string('pluginname', $this->modulename),
            $this->modulename, array('class' => 'iconlarge icon-post')));
        $this->add_setting($activity_included);
        // Look for "activities" root setting
        $activities = $this->plan->get_setting('activities');
        $activities->add_dependency($activity_included);

        if (question_module_uses_questions($this->modulename)) {
            $questionbank = $this->plan->get_setting('questionbank');
            $questionbank->add_dependency($activity_included);
        }

        // Look for "section_included" section setting (if exists)
        $settingname = 'section_' . $this->sectionid . '_included';
        if ($this->plan->setting_exists($settingname)) {
            $section_included = $this->plan->get_setting($settingname);
            $section_included->add_dependency($activity_included);
        }

        // Define activity_userinfo. Dependent of:
        // - users root setting
        // - section_userinfo setting (if exists)
        // - activity_included setting
        $settingname = $settingprefix . 'userinfo';
        $activity_userinfo = new backup_activity_userinfo_setting($settingname, base_setting::IS_BOOLEAN, true);
        //$activity_userinfo->get_ui()->set_label(get_string('includeuserinfo','backup'));
        $activity_userinfo->get_ui()->set_label('-');
        $this->add_setting($activity_userinfo);
        // Look for "users" root setting
        $users = $this->plan->get_setting('users');
        $users->add_dependency($activity_userinfo);
        // Look for "section_userinfo" section setting (if exists)
        $settingname = 'section_' . $this->sectionid . '_userinfo';
        if ($this->plan->setting_exists($settingname)) {
            $section_userinfo = $this->plan->get_setting($settingname);
            $section_userinfo->add_dependency($activity_userinfo);
        }
        // Look for "activity_included" setting
        $activity_included->add_dependency($activity_userinfo);

        // End of common activity settings, let's add the particular ones
        $this->define_my_settings();
    }
851182
function createBoilerplateFolder(answers) {
    return createFolder(answers.name)
        .tap(createFolder(`${answers.name}/info`))
        .catch(~reject(new Error(`Unable to create folder ${answers.name}`)))
        .return(answers);
}
108327
private static void setIncomeBudgetPeriods(PHS398CoverPageSupplement20 coverPageSupplement,
            List<? extends BudgetProjectIncomeContract> projectIncomes) {
        if (projectIncomes.isEmpty()) {
            coverPageSupplement.setProgramIncome(YesNoDataType.N_NO);
        } else {
            coverPageSupplement.setProgramIncome(YesNoDataType.Y_YES);
        }
        coverPageSupplement.setIncomeBudgetPeriodArray(getIncomeBudgetPeriod(projectIncomes));
    }
801352
def set_settings(self, subreddit, title, public_description='',
                     description='', language='en', subreddit_type='public',
                     content_options='any', over_18=False, default_set=True,
                     show_media=False, domain='', domain_css=False,
                     domain_sidebar=False, header_hover_text='',
                     wikimode='disabled', wiki_edit_age=30,
                     wiki_edit_karma=100,
                     submit_link_label='', submit_text_label='',
                     exclude_banned_modqueue=False, comment_score_hide_mins=0,
                     public_traffic=False, collapse_deleted_comments=False,
                     spam_comments='low', spam_links='high',
                     spam_selfposts='high', submit_text='',
                     hide_ads=False, suggested_comment_sort='',
                     key_color='',
                     **kwargs):
        
        data = {'sr': subreddit.fullname,
                'allow_top': default_set,
                'comment_score_hide_mins': comment_score_hide_mins,
                'collapse_deleted_comments': collapse_deleted_comments,
                'description': description,
                'domain': domain or '',
                'domain_css': domain_css,
                'domain_sidebar': domain_sidebar,
                'exclude_banned_modqueue': exclude_banned_modqueue,
                'header-title': header_hover_text or '',
                'hide_ads': hide_ads,
                'key_color': key_color,
                'lang': language,
                'link_type': content_options,
                'over_18': over_18,
                'public_description': public_description,
                'public_traffic': public_traffic,
                'show_media': show_media,
                'submit_link_label': submit_link_label or '',
                'submit_text': submit_text,
                'submit_text_label': submit_text_label or '',
                'suggested_comment_sort': suggested_comment_sort or '',
                'spam_comments': spam_comments,
                'spam_links': spam_links,
                'spam_selfposts': spam_selfposts,
                'title': title,
                'type': subreddit_type,
                'wiki_edit_age': six.text_type(wiki_edit_age),
                'wiki_edit_karma': six.text_type(wiki_edit_karma),
                'wikimode': wikimode}

        if kwargs:
            msg = 'Extra settings fields: {0}'.format(kwargs.keys())
            warn_explicit(msg, UserWarning, '', 0)
            data.update(kwargs)
        evict = self.config['subreddit_settings'].format(
            subreddit=six.text_type(subreddit))
        self.evict(evict)
        return self.request_json(self.config['site_admin'], data=data)
1267267
def prompt(questions: List[Dict[Text, Any]],
           answers: Optional[Dict[Text, Any]] = None,
           patch_stdout: bool = False,
           true_color: bool = False,
           kbi_msg: Text = DEFAULT_KBI_MESSAGE,
           **kwargs):
    """"""

    if isinstance(questions, dict):
        questions = [questions]

    answers = answers or {}

    for question_config in questions:
        # import the question
        if 'type' not in question_config:
            raise PromptParameterException('type')
        if 'name' not in question_config:
            raise PromptParameterException('name')

        choices = question_config.get('choices')
        if choices is not None and callable(choices):
            question_config['choices'] = choices(answers)

        _kwargs = kwargs.copy()
        _kwargs.update(question_config)

        _type = _kwargs.pop('type')
        _filter = _kwargs.pop('filter', None)
        name = _kwargs.pop('name')
        when = _kwargs.pop('when', None)

        if true_color:
            _kwargs["color_depth"] = ColorDepth.TRUE_COLOR

        try:
            if when:
                # at least a little sanity check!
                if callable(question_config['when']):
                    try:
                        if not question_config['when'](answers):
                            continue
                    except Exception as e:
                        raise ValueError("Problem in 'when' check of {} "
                                         "question: {}".format(name, e))
                else:
                    raise ValueError("'when' needs to be function that "
                                     "accepts a dict argument")
            if _filter:
                # at least a little sanity check!
                if not callable(_filter):
                    raise ValueError("'filter' needs to be function that "
                                     "accepts an argument")

            if callable(question_config.get('default')):
                _kwargs['default'] = question_config['default'](answers)

            create_question_func = prompt_by_name(_type)

            if not create_question_func:
                raise ValueError("No question type '{}' found. "
                                 "Known question types are {}."
                                 "".format(_type, ", ".join(AVAILABLE_PROMPTS)))

            missing_args = list(utils.missing_arguments(create_question_func,
                                                        _kwargs))
            if missing_args:
                raise PromptParameterException(missing_args[0])

            question = create_question_func(**_kwargs)

            answer = question.unsafe_ask(patch_stdout)

            if answer is not None:
                if _filter:
                    try:
                        answer = _filter(answer)
                    except Exception as e:
                        raise ValueError("Problem processing 'filter' of {} "
                                         "question: {}".format(name, e))
                answers[name] = answer
        except KeyboardInterrupt:
            print('')
            print(kbi_msg)
            print('')
            return {}
    return answers
782450
def _initialize_part_map(self):
        """"""
        self._my_map['assessmentParts'] = []
        self._my_map['questions'] = []
        item_ids = self._assessment_part.get_item_ids()
        if item_ids.available():
            # This is a simple section:
            self._load_simple_section_questions(item_ids)
        else:
            # This goes down the winding path...
            # let's not call this...seems redundant, and per Jeff, this might
            # save us time.
            # self._update_questions()
            pass
734412
private function setSenderDocument()
    {
        $this->_paymentRequest->setSender()->setDocument()->withParameters(
            $this->_data['sender_document']['type'],
            $this->_data['sender_document']['number']
        );
    }
376740
public function applyDetailSettings()
    {
        $commUtil = $this->util->getCommTemplateUtil();

        $staffTemplates = $commUtil->getCommTemplatesForTarget('staffPassword', null, true);

        $this->applyBrowseSettings();

        $this->set('gor_welcome',                   'label', $this->_('Greeting'),
                'description', $this->_('For emails and token forward screen.'), 'elementClass', 'Textarea', 'rows', 5);
        $this->set('gor_signature',                 'label', $this->_('Signature'),
                'description', $this->_('For emails and token forward screen.'), 'elementClass', 'Textarea', 'rows', 5);
        $this->set('gor_create_account_template',   'label', $this->_('Create Account template'),
                'default', $commUtil->getCommTemplateForCode('accountCreate', 'staffPassword'),
                'multiOptions', $staffTemplates);
        $this->set('gor_reset_pass_template',       'label', $this->_('Reset Password template'),
                'default', $commUtil->getCommTemplateForCode('passwordReset', 'staffPassword'),
                'multiOptions', $staffTemplates);

        $this->setIfExists('gor_allowed_ip_ranges', 'label', $this->_('Allowed IP Ranges'),
            'description', $this->_('Separate with | examples: 10.0.0.0-10.0.0.255, 10.10.*.*, 10.10.151.1 or 10.10.151.1/25')
            );

        if ($this->project->multiLocale) {
            $this->set('gor_name', 'description', 'ENGLISH please! Use translation file to translate.');
            $this->set('gor_url',  'description', 'ENGLISH link preferred. Use translation file to translate.');
        }

        return $this;
    }