mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
BUG: Coding convention changes mainly replacing spaces with tabs
This commit is contained in:
parent
eba5edd60b
commit
e4875edd05
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,6 +129,6 @@
|
||||
<% end_if %>
|
||||
|
||||
<!-- Hidden option Fields -->
|
||||
<input type="hidden" class="typeHidden" name="{$FieldName}[Type]" value="$ClassName" />
|
||||
<input type="hidden" class="typeHidden" name="{$FieldName}[Type]" value="$ClassName" />
|
||||
<input type="hidden" class="sortHidden" name="{$FieldName}[Sort]" value="$Sort" />
|
||||
</li>
|
||||
</li>
|
||||
|
@ -25,19 +25,19 @@
|
||||
<div class="userforms-submissions-pagination">
|
||||
<span><% _t('PAGES', 'Pages') %>:</span>
|
||||
|
||||
<% loop Submissions.Pages() %>
|
||||
<% if CurrentBool %>
|
||||
$PageNum
|
||||
<% else %>
|
||||
<% if Link %>
|
||||
<a href="{$Top.Link(getMoreSubmissions)}?page=$PageNum">$PageNum</a>
|
||||
<% else %>
|
||||
...
|
||||
<% end_if %>
|
||||
<% end_if %>
|
||||
<% end_loop %>
|
||||
<% loop Submissions.Pages() %>
|
||||
<% if CurrentBool %>
|
||||
$PageNum
|
||||
<% else %>
|
||||
<% if Link %>
|
||||
<a href="{$Top.Link(getMoreSubmissions)}?page=$PageNum">$PageNum</a>
|
||||
<% else %>
|
||||
...
|
||||
<% end_if %>
|
||||
<% end_if %>
|
||||
<% end_loop %>
|
||||
</div>
|
||||
<% end_if %>
|
||||
<% end_if %>
|
||||
|
||||
<% else %>
|
||||
<p class="userforms-nosubmissions" <% if Submissions %>style="display: none"<% end_if %>><% _t('NOSUBMISSIONS', 'No Submissions') %></p>
|
||||
|
@ -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();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user