From e4875edd05378ef5ca8b5962629a942637644363 Mon Sep 17 00:00:00 2001 From: Kirk Mayo Date: Tue, 17 Jul 2012 16:09:31 +1200 Subject: [PATCH] BUG: Coding convention changes mainly replacing spaces with tabs --- code/formfields/FieldEditor.php | 24 +++++++++---------- code/model/UserDefinedForm.php | 16 ++++++------- code/model/formfields/EditableDateField.php | 4 ++-- code/model/formfields/EditableFormField.php | 4 ++-- .../EditableMultipleOptionField.php | 6 ++--- code/model/formfields/EditableRadioField.php | 4 ++-- code/model/formfields/EditableTextField.php | 4 ++-- code/model/submissions/SubmittedFileField.php | 4 ++-- templates/EditableFormField.ss | 4 ++-- templates/SubmittedFormReportField.ss | 24 +++++++++---------- tests/EditableFormFieldTest.php | 4 ++-- tests/UserDefinedFormControllerTest.php | 2 +- 12 files changed, 50 insertions(+), 50 deletions(-) diff --git a/code/formfields/FieldEditor.php b/code/formfields/FieldEditor.php index 826e176..fa92932 100755 --- a/code/formfields/FieldEditor.php +++ b/code/formfields/FieldEditor.php @@ -138,10 +138,10 @@ class FieldEditor extends FormField { if(!is_numeric($newEditableID)) continue; // get it from the db - $editable = DataObject::get_by_id('EditableFormField', $newEditableID); + $editable = DataObject::get_by_id('EditableFormField', $newEditableID); - // if it exists in the db update it - if($editable) { + // if it exists in the db update it + if($editable) { // remove it from the removed fields list if(isset($missingFields[$editable->ID]) && isset($newEditableData) && is_array($newEditableData)) { @@ -156,18 +156,18 @@ class FieldEditor extends FormField { // save data $editable->populateFromPostData($newEditableData); } - } + } } - // remove the fields not saved + // remove the fields not saved if($this->canEdit()) { - foreach($missingFields as $removedField) { - if(is_numeric($removedField->ID)) { - // check we can edit this - $removedField->delete(); - } + foreach($missingFields as $removedField) { + if(is_numeric($removedField->ID)) { + // check we can edit this + $removedField->delete(); + } } - } + } } /** @@ -232,4 +232,4 @@ class FieldEditor extends FormField { } return false; } -} \ No newline at end of file +} diff --git a/code/model/UserDefinedForm.php b/code/model/UserDefinedForm.php index 5e032b6..415c689 100755 --- a/code/model/UserDefinedForm.php +++ b/code/model/UserDefinedForm.php @@ -69,13 +69,13 @@ class UserDefinedForm extends Page { // view the submissions $fields->addFieldToTab("Root.Submissions", new CheckboxField('DisableSaveSubmissions',_t('UserDefinedForm.SAVESUBMISSIONS',"Disable Saving Submissions to Server"))); $fields->addFieldToTab("Root.Submissions", new SubmittedFormReportField( "Reports", _t('UserDefinedForm.RECEIVED', 'Received Submissions'), "", $this ) ); - + UserDefinedForm_EmailRecipient::$summary_fields=array( 'EmailAddress' => _t('UserDefinedForm.EMAILADDRESS', 'Email'), 'EmailSubject' => _t('UserDefinedForm.EMAILSUBJECT', 'Subject'), 'EmailFrom' => _t('UserDefinedForm.EMAILFROM', 'From') ); - + // who do we email on submission $emailRecipients = new GridField("EmailRecipients", "EmailRecipients", $this->EmailRecipients(), GridFieldConfig_RecordEditor::create(10)); @@ -251,7 +251,7 @@ class UserDefinedForm extends Page { * * @return FieldSet */ - public function getFormOptions() { + public function getFormOptions() { $submit = ($this->SubmitButtonText) ? $this->SubmitButtonText : _t('UserDefinedForm.SUBMITBUTTON', 'Submit'); $options = new FieldList( @@ -734,7 +734,7 @@ JS // email users on submit. if($this->EmailRecipients()) { - $email = new UserDefinedForm_SubmittedFormEmail($submittedFields); + $email = new UserDefinedForm_SubmittedFormEmail($submittedFields); $email->populateTemplate($emailData); if($attachments){ @@ -770,7 +770,7 @@ JS } $this->extend('updateEmail', $email, $recipient, $emailData); - + if($recipient->SendPlain) { $body = strip_tags($recipient->EmailBody) . "\n "; if(isset($emailData['Fields']) && !$recipient->HideFormData) { @@ -867,7 +867,7 @@ class UserDefinedForm_EmailRecipient extends DataObject { if($multiOptionFields || $validEmailFields) { if($multiOptionFields && $validEmailFields) { - $multiOptionFields=$multiOptionFields->toArray(); + $multiOptionFields=$multiOptionFields->toArray(); $multiOptionFields=array_merge($multiOptionFields, $validEmailFields->toArray()); $multiOptionFields=ArrayList::create($multiOptionFields); } @@ -880,8 +880,8 @@ class UserDefinedForm_EmailRecipient extends DataObject { $multiOptionFields, '', null, ""), 'EmailAddress'); } } - - $this->extend('updateCMSFields', $fields); + + $this->extend('updateCMSFields', $fields); return $fields; } diff --git a/code/model/formfields/EditableDateField.php b/code/model/formfields/EditableDateField.php index a83e1e1..c2098fa 100755 --- a/code/model/formfields/EditableDateField.php +++ b/code/model/formfields/EditableDateField.php @@ -38,7 +38,7 @@ class EditableDateField extends EditableFormField { */ public function getFormField() { $defaultValue = ($this->getSetting('DefaultToToday')) ? date('Y-m-d') : $this->Default; - $field = new DateField( $this->Name, $this->Title, $defaultValue); + $field = new DateField( $this->Name, $this->Title, $defaultValue); $field->setConfig('showcalendar', true); return $field; } @@ -56,4 +56,4 @@ class EditableDateField extends EditableFormField { 'date' => true ); } -} \ No newline at end of file +} diff --git a/code/model/formfields/EditableFormField.php b/code/model/formfields/EditableFormField.php index 5d886bb..58aa8aa 100755 --- a/code/model/formfields/EditableFormField.php +++ b/code/model/formfields/EditableFormField.php @@ -28,7 +28,7 @@ class EditableFormField extends DataObject { "CustomSettings" => "Text", "CustomParameter" => "Varchar(200)" ); - + static $has_one = array( "Parent" => "UserDefinedForm", ); @@ -446,7 +446,7 @@ class EditableFormField extends DataObject { public function showInReports() { return true; } - + /** * Return the validation information related to this field. This is * interrupted as a JSON object for validate plugin and used in the diff --git a/code/model/formfields/EditableMultipleOptionField.php b/code/model/formfields/EditableMultipleOptionField.php index 9344ea3..a3c4668 100644 --- a/code/model/formfields/EditableMultipleOptionField.php +++ b/code/model/formfields/EditableMultipleOptionField.php @@ -69,7 +69,7 @@ class EditableMultipleOptionField extends EditableFormField { * @return void */ public function delete() { - $options = $this->Options(); + $options = $this->Options(); if($options) { foreach($options as $option) { @@ -77,7 +77,7 @@ class EditableMultipleOptionField extends EditableFormField { } } - parent::delete(); + parent::delete(); } /** @@ -141,4 +141,4 @@ class EditableMultipleOptionField extends EditableFormField { public function getFormField() { return user_error('Please implement getFormField() on '. $this->class, E_USER_ERROR); } -} \ No newline at end of file +} diff --git a/code/model/formfields/EditableRadioField.php b/code/model/formfields/EditableRadioField.php index b8f0605..e082f95 100755 --- a/code/model/formfields/EditableRadioField.php +++ b/code/model/formfields/EditableRadioField.php @@ -13,7 +13,7 @@ class EditableRadioField extends EditableMultipleOptionField { static $plural_name = 'Radio fields'; - public function getFormField() { + public function getFormField() { $optionSet = $this->Options(); $options = array(); @@ -25,4 +25,4 @@ class EditableRadioField extends EditableMultipleOptionField { return new OptionsetField($this->Name, $this->Title, $options); } -} \ No newline at end of file +} diff --git a/code/model/formfields/EditableTextField.php b/code/model/formfields/EditableTextField.php index 145b8e6..5caacb8 100755 --- a/code/model/formfields/EditableTextField.php +++ b/code/model/formfields/EditableTextField.php @@ -39,7 +39,7 @@ class EditableTextField extends EditableFormField { */ public function getFormField() { if($this->getSetting('Rows') && $this->getSetting('Rows') > 1) { - $taf = new TextareaField($this->Name, $this->Title); + $taf = new TextareaField($this->Name, $this->Title); $taf->setRows($this->getSetting('Rows')); return $taf; } @@ -67,4 +67,4 @@ class EditableTextField extends EditableFormField { return $options; } -} \ No newline at end of file +} diff --git a/code/model/submissions/SubmittedFileField.php b/code/model/submissions/SubmittedFileField.php index 6cbfd3c..188c599 100755 --- a/code/model/submissions/SubmittedFileField.php +++ b/code/model/submissions/SubmittedFileField.php @@ -46,7 +46,7 @@ class SubmittedFileField extends SubmittedFormField { */ public function getLink() { if($file = $this->UploadedFile()) { - if(trim($file->getFilename(), '/') != trim(ASSETS_DIR,'/')) { + if(trim($file->getFilename(), '/') != trim(ASSETS_DIR,'/')) { return $this->UploadedFile()->URL; } } @@ -62,4 +62,4 @@ class SubmittedFileField extends SubmittedFormField { return $this->UploadedFile()->Name; } } -} \ No newline at end of file +} diff --git a/templates/EditableFormField.ss b/templates/EditableFormField.ss index 26c8e0e..c53169f 100755 --- a/templates/EditableFormField.ss +++ b/templates/EditableFormField.ss @@ -129,6 +129,6 @@ <% end_if %> - + - \ No newline at end of file + diff --git a/templates/SubmittedFormReportField.ss b/templates/SubmittedFormReportField.ss index 3ae8bea..a1f456a 100644 --- a/templates/SubmittedFormReportField.ss +++ b/templates/SubmittedFormReportField.ss @@ -25,19 +25,19 @@
<% _t('PAGES', 'Pages') %>: - <% loop Submissions.Pages() %> - <% if CurrentBool %> - $PageNum - <% else %> - <% if Link %> - $PageNum - <% else %> - ... - <% end_if %> - <% end_if %> - <% end_loop %> + <% loop Submissions.Pages() %> + <% if CurrentBool %> + $PageNum + <% else %> + <% if Link %> + $PageNum + <% else %> + ... + <% end_if %> + <% end_if %> + <% end_loop %>
- <% end_if %> + <% end_if %> <% else %>

style="display: none"<% end_if %>><% _t('NOSUBMISSIONS', 'No Submissions') %>

diff --git a/tests/EditableFormFieldTest.php b/tests/EditableFormFieldTest.php index ad993be..515c65b 100644 --- a/tests/EditableFormFieldTest.php +++ b/tests/EditableFormFieldTest.php @@ -153,7 +153,7 @@ class EditableFormFieldTest extends FunctionalTest { $rules = $field->CustomRules(); // form has 2 fields - a checkbox and a text field - // it has 1 rule - when ticked the checkbox hides the text field + // it has 1 rule - when ticked the checkbox hides the text field $this->assertEquals($rules->Count(), 1); // rules are ArrayDatas not dataobjects @@ -301,4 +301,4 @@ class EditableFormFieldTest extends FunctionalTest { // $configuration = $text->getFieldConfiguration(); } -} \ No newline at end of file +} diff --git a/tests/UserDefinedFormControllerTest.php b/tests/UserDefinedFormControllerTest.php index b0b0f92..4fd3012 100644 --- a/tests/UserDefinedFormControllerTest.php +++ b/tests/UserDefinedFormControllerTest.php @@ -78,7 +78,7 @@ class UserDefinedFormControllerTest extends FunctionalTest { $requiredForm = $this->objFromFixture('UserDefinedForm', 'validation-form'); $controller = new UserDefinedFormControllerTest_Controller($requiredForm); - $this->assertEquals($controller->Form()->Fields()->Count(), 1); // disabled SecurityID token fields + $this->assertEquals($controller->Form()->Fields()->Count(), 1); // disabled SecurityID token fields $this->assertEquals($controller->Form()->Actions()->Count(), 1); $this->assertEquals(count($controller->Form()->getValidator()->getRequired()), 1); }