Indefero

Indefero Commit Details


Date:2011-04-06 05:00:55 (13 years 8 months ago)
Author:William MARTIN
Branch:develop, feature-issue_links, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, release-1.2, release-1.3
Commit:4ee3d471fef4667d0a2b3d4e4abe7b8fb3e0c8f8
Parents: 9b92b7139f91ba463da48a85d273b6140fb81150
Message:Update the form validation of IDF_Form_ReviewFileComment. Now we can add a general comment without per file comment.

Changes:

File differences

src/IDF/Form/ReviewFileComment.php
5252
5353
5454
55
55
5656
5757
5858
......
9696
9797
9898
99
100
101
99
100
101
102
103
104
102105
103106
104
107
108
109
110
111
112
113
114
115
116
105117
106118
107119
108120
109121
110
111
122
123
124
125
126
127
112128
113
129
130
114131
115132
116
117133
118134
119135
));
}
$this->fields['content'] = new Pluf_Form_Field_Varchar(
array('required' => true,
array('required' => false,
'label' => __('General comment'),
'initial' => '',
'widget' => 'Pluf_Form_Widget_TextareaInput',
*/
public function clean()
{
foreach ($this->files as $filename => $def) {
if (!empty($this->cleaned_data[md5($filename)])) {
return $this->cleaned_data;
$isOk = false;
foreach($this->files as $filename => $def) {
$this->cleaned_data[md5($filename)] = trim($this->cleaned_data[md5($filename)]);
if(!empty($this->cleaned_data[md5($filename)])) {
$isOk = true;
}
}
throw new Pluf_Form_Invalid(__('You need to provide comments on at least one file.'));
if(!empty($this->cleaned_data['content'])) {
$isOk = true;
}
if (!$isOk) {
throw new Pluf_Form_Invalid(__('You need to provide your general comment about the proposal, or comments on at least one file.'));
}
return $this->cleaned_data;
}
function clean_content()
{
$content = trim($this->cleaned_data['content']);
if (!$this->show_full and strlen($content) == 0) {
throw new Pluf_Form_Invalid(__('You need to provide your general comment about the proposal.'));
if(empty($content)) {
if ($this->fields['status']->initial != $this->fields['status']->value) {
return __('The status have been updated.');
}
} else {
return $content;
}
return $content;
throw new Pluf_Form_Invalid(__('This field is required.'));
}
/**
* Save the model in the database.
*

Archive Download the corresponding diff file

Page rendered in 0.07562s using 13 queries.