Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented mandatory option for multiple choice entries. #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions design/standard/templates/survey/edit/multiplechoice.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
</select>
</div>

<div class="block">
<input type="hidden" name="{$prefix_attribute}_ezsurvey_question_{$question.id}_mandatory_hidden_{$attribute_id}" value="1" />
<label><input type="checkbox" name="{$prefix_attribute}_ezsurvey_question_{$question.id}_mandatory_{$attribute_id}" value="1"{section show=$question.mandatory} checked="checked"{/section} />
{"Mandatory answer"|i18n('survey')}</label>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cs: indenting

</div>

<table class="list" cellspacing="0">
<tr>
<th class="tight">&nbsp;</th>
Expand Down
3 changes: 3 additions & 0 deletions design/standard/templates/survey/rview.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
<form class="float" action={concat('/survey/result_edit/', $result_id)|ezurl()} style="float: left; margin-right: 0.3em;">
<input class="button" name="EditSruveyResultButton" type="submit" value="Edit" method="post" />
</form>
<form class="float" action={concat('/survey/result_remove/', $result_id)|ezurl()} style="float: left; margin-right: 0.3em;">
<input class="button" name="RemoveSurveyResultButton" type="submit" value="Remove" method="post" />
</form>
<form class="float" action={concat('/survey/export/', $contentobject_id, '/', $contentclassattribute_id, '/', $language_code, '/')|ezurl()} style="float: left;">
<input class="button" name="ExportCSVButton" type="submit" value="Export CSV" method="post" />
</form>
Expand Down
2 changes: 1 addition & 1 deletion design/standard/templates/survey/view/multiplechoice.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<label>{$question.question_number}. {$question.text|wash('xhtml')} {switch match=$question.num}{case match=1}<strong class="required">*</strong>{/case}{case match=2}<strong class="required">*</strong>{/case}{/switch}</label>
<label>{$question.question_number}. {$question.text|wash('xhtml')} {if $question.mandatory}<strong class="required">*</strong>{/if}</label>
<div class="survey-choices float-break">
{def $attr_id=concat($prefix_attribute,'_ezsurvey_answer_id_',$question.id,'_', $attribute_id)}
{def $attr_name=concat($prefix_attribute, '_ezsurvey_answer_' , $question.id, '_' , $attribute_id)}
Expand Down
1 change: 1 addition & 0 deletions modules/survey/classes/ezsurveymultiplechoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ function processViewActions( &$validation, $params )

$postSurveyAnswer = $prefix . '_ezsurvey_answer_' . $this->ID . '_' . $attributeID;
if ( !$http->hasPostVariable( $postSurveyAnswer ) and
$this->attribute('mandatory') and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CS: spaces around arguments inside ()

$this->attribute( 'num' ) != 3 and // 3 - checkboxes in a row
$this->attribute( 'num' ) != 4 ) // 4 - checkboxes in a column
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created on: <10-Jun-2005 15:55:33 sp>
//

// Copyright (C) 1999-2013 eZ Systems AS. All rights reserved.
// Copyright (C) 1999-2010 eZ Systems AS. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? :)

//
// This source file is part of the eZ Publish (tm) Open Source Content
// Management System.
Expand Down