mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 15:05:42 +00: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;
|
if(!is_numeric($newEditableID)) continue;
|
||||||
|
|
||||||
// get it from the db
|
// 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 it exists in the db update it
|
||||||
if($editable) {
|
if($editable) {
|
||||||
|
|
||||||
// remove it from the removed fields list
|
// remove it from the removed fields list
|
||||||
if(isset($missingFields[$editable->ID]) && isset($newEditableData) && is_array($newEditableData)) {
|
if(isset($missingFields[$editable->ID]) && isset($newEditableData) && is_array($newEditableData)) {
|
||||||
@ -156,18 +156,18 @@ class FieldEditor extends FormField {
|
|||||||
// save data
|
// save data
|
||||||
$editable->populateFromPostData($newEditableData);
|
$editable->populateFromPostData($newEditableData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove the fields not saved
|
// remove the fields not saved
|
||||||
if($this->canEdit()) {
|
if($this->canEdit()) {
|
||||||
foreach($missingFields as $removedField) {
|
foreach($missingFields as $removedField) {
|
||||||
if(is_numeric($removedField->ID)) {
|
if(is_numeric($removedField->ID)) {
|
||||||
// check we can edit this
|
// check we can edit this
|
||||||
$removedField->delete();
|
$removedField->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -251,7 +251,7 @@ class UserDefinedForm extends Page {
|
|||||||
*
|
*
|
||||||
* @return FieldSet
|
* @return FieldSet
|
||||||
*/
|
*/
|
||||||
public function getFormOptions() {
|
public function getFormOptions() {
|
||||||
$submit = ($this->SubmitButtonText) ? $this->SubmitButtonText : _t('UserDefinedForm.SUBMITBUTTON', 'Submit');
|
$submit = ($this->SubmitButtonText) ? $this->SubmitButtonText : _t('UserDefinedForm.SUBMITBUTTON', 'Submit');
|
||||||
|
|
||||||
$options = new FieldList(
|
$options = new FieldList(
|
||||||
@ -867,7 +867,7 @@ class UserDefinedForm_EmailRecipient extends DataObject {
|
|||||||
if($multiOptionFields || $validEmailFields) {
|
if($multiOptionFields || $validEmailFields) {
|
||||||
|
|
||||||
if($multiOptionFields && $validEmailFields) {
|
if($multiOptionFields && $validEmailFields) {
|
||||||
$multiOptionFields=$multiOptionFields->toArray();
|
$multiOptionFields=$multiOptionFields->toArray();
|
||||||
$multiOptionFields=array_merge($multiOptionFields, $validEmailFields->toArray());
|
$multiOptionFields=array_merge($multiOptionFields, $validEmailFields->toArray());
|
||||||
$multiOptionFields=ArrayList::create($multiOptionFields);
|
$multiOptionFields=ArrayList::create($multiOptionFields);
|
||||||
}
|
}
|
||||||
@ -881,7 +881,7 @@ class UserDefinedForm_EmailRecipient extends DataObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->extend('updateCMSFields', $fields);
|
$this->extend('updateCMSFields', $fields);
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ class EditableDateField extends EditableFormField {
|
|||||||
*/
|
*/
|
||||||
public function getFormField() {
|
public function getFormField() {
|
||||||
$defaultValue = ($this->getSetting('DefaultToToday')) ? date('Y-m-d') : $this->Default;
|
$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);
|
$field->setConfig('showcalendar', true);
|
||||||
return $field;
|
return $field;
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ class EditableMultipleOptionField extends EditableFormField {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function delete() {
|
public function delete() {
|
||||||
$options = $this->Options();
|
$options = $this->Options();
|
||||||
|
|
||||||
if($options) {
|
if($options) {
|
||||||
foreach($options as $option) {
|
foreach($options as $option) {
|
||||||
|
@ -13,7 +13,7 @@ class EditableRadioField extends EditableMultipleOptionField {
|
|||||||
|
|
||||||
static $plural_name = 'Radio fields';
|
static $plural_name = 'Radio fields';
|
||||||
|
|
||||||
public function getFormField() {
|
public function getFormField() {
|
||||||
$optionSet = $this->Options();
|
$optionSet = $this->Options();
|
||||||
$options = array();
|
$options = array();
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class EditableTextField extends EditableFormField {
|
|||||||
*/
|
*/
|
||||||
public function getFormField() {
|
public function getFormField() {
|
||||||
if($this->getSetting('Rows') && $this->getSetting('Rows') > 1) {
|
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'));
|
$taf->setRows($this->getSetting('Rows'));
|
||||||
return $taf;
|
return $taf;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ class SubmittedFileField extends SubmittedFormField {
|
|||||||
*/
|
*/
|
||||||
public function getLink() {
|
public function getLink() {
|
||||||
if($file = $this->UploadedFile()) {
|
if($file = $this->UploadedFile()) {
|
||||||
if(trim($file->getFilename(), '/') != trim(ASSETS_DIR,'/')) {
|
if(trim($file->getFilename(), '/') != trim(ASSETS_DIR,'/')) {
|
||||||
return $this->UploadedFile()->URL;
|
return $this->UploadedFile()->URL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,6 +129,6 @@
|
|||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
|
||||||
<!-- Hidden option Fields -->
|
<!-- 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" />
|
<input type="hidden" class="sortHidden" name="{$FieldName}[Sort]" value="$Sort" />
|
||||||
</li>
|
</li>
|
@ -25,19 +25,19 @@
|
|||||||
<div class="userforms-submissions-pagination">
|
<div class="userforms-submissions-pagination">
|
||||||
<span><% _t('PAGES', 'Pages') %>:</span>
|
<span><% _t('PAGES', 'Pages') %>:</span>
|
||||||
|
|
||||||
<% loop Submissions.Pages() %>
|
<% loop Submissions.Pages() %>
|
||||||
<% if CurrentBool %>
|
<% if CurrentBool %>
|
||||||
$PageNum
|
$PageNum
|
||||||
<% else %>
|
<% else %>
|
||||||
<% if Link %>
|
<% if Link %>
|
||||||
<a href="{$Top.Link(getMoreSubmissions)}?page=$PageNum">$PageNum</a>
|
<a href="{$Top.Link(getMoreSubmissions)}?page=$PageNum">$PageNum</a>
|
||||||
<% else %>
|
<% else %>
|
||||||
...
|
...
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
<% end_loop %>
|
<% end_loop %>
|
||||||
</div>
|
</div>
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
|
|
||||||
<% else %>
|
<% else %>
|
||||||
<p class="userforms-nosubmissions" <% if Submissions %>style="display: none"<% end_if %>><% _t('NOSUBMISSIONS', 'No Submissions') %></p>
|
<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();
|
$rules = $field->CustomRules();
|
||||||
|
|
||||||
// form has 2 fields - a checkbox and a text field
|
// 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);
|
$this->assertEquals($rules->Count(), 1);
|
||||||
|
|
||||||
// rules are ArrayDatas not dataobjects
|
// rules are ArrayDatas not dataobjects
|
||||||
|
@ -78,7 +78,7 @@ class UserDefinedFormControllerTest extends FunctionalTest {
|
|||||||
$requiredForm = $this->objFromFixture('UserDefinedForm', 'validation-form');
|
$requiredForm = $this->objFromFixture('UserDefinedForm', 'validation-form');
|
||||||
$controller = new UserDefinedFormControllerTest_Controller($requiredForm);
|
$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($controller->Form()->Actions()->Count(), 1);
|
||||||
$this->assertEquals(count($controller->Form()->getValidator()->getRequired()), 1);
|
$this->assertEquals(count($controller->Form()->getValidator()->getRequired()), 1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user