(merged from branches/roa. use "svn log -c <changeset> -g <module-svn-path>" for detailed commit message)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60289 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-08-11 00:21:44 +00:00
parent ad4d506f82
commit b8adcd8aad
6 changed files with 59 additions and 27 deletions

View File

@ -61,6 +61,15 @@ form .indicator.block {
display: inline;
}
/* Emulating link styling for actions requiring lesser attention, e.g. "cancel" FormActions */
form button.minorAction {
background: none;
padding: 0;
border: 0;
color: #0074C6; /* same for "a" tag in cms/css/typography.css */
text-decoration: underline;
}
/**
* Composite Fields - raw concatenation of fields for programmatic purposes.

View File

@ -8,8 +8,12 @@
class ResetFormAction extends FormAction {
function Field() {
if($this->description) $titleAttr = "title=\"" . Convert::raw2att($this->description) . "\"";
return "<input class=\"action\" id=\"" . $this->id() . "\" type=\"reset\" name=\"{$this->name}\" value=\"" . $this->attrTitle() . "\" $titleAttr />";
$titleAttr = $this->description ? "title=\"" . Convert::raw2att($this->description) . "\"" : '';
if($this->useButtonTag) {
return "<button class=\"action " . $this->extraClass() . "\" id=\"" . $this->id() . "\" type=\"reset\" name=\"$this->action\" $titleAttr />" . $this->attrTitle() . "</button>\n";
} else {
return "<input class=\"action " . $this->extraClass() . "\" id=\"" . $this->id() . "\" type=\"reset\" name=\"$this->action\" value=\"" . $this->attrTitle() . "\" $titleAttr />\n";
}
}
}

View File

@ -1,4 +1,10 @@
<?php
/**
* @package forms
* @subpackage fields-relational
*/
/**
* Form field that embeds a list into a form, such as a member list or a file list.
*
@ -118,6 +124,20 @@ class TableListField extends FormField {
*/
protected $csvHasHeader = true;
/**
* @var array Specify custom escape for the fields.
*
* <code>
* array("\""=>"\"\"","\r"=>"", "\r\n"=>"", "\n"=>"")
* </code>
*/
public $csvFieldEscape = array(
"\""=>"\"\"",
"\r\n"=>"",
"\r"=>"",
"\n"=>"",
);
/**
* @var int Shows total count regardless or pagination
@ -165,14 +185,6 @@ class TableListField extends FormField {
*/
public $fieldFormatting = array();
/**
* @var array Specify custom escape for the fields, e.g. to escape all accurance of "\r", "\r\n" and "\n" of the field
* value, we need to set this field as array("\r"=>"", "\r\n"=>"", "\n"=>"") ;
* Example: setFieldEscape(array("\""=>"\"\"","\r"=>"", "\r\n"=>"", "\n"=>"") is needed for exporting the table to a .csv
* file
*/
public $fieldEscape = array();
/**
* @var string
*/
@ -829,29 +841,33 @@ JS
$sourceClass = $this->sourceClass;
$dataobject = new $sourceClass();
// @todo Will create a large unpaginated dataobjectset based on how many records are in table (performance issue)
$items = $dataobject->buildDataObjectSet($records, 'DataObjectSet');
$fieldItems = new DataObjectSet();
if($items&&$items->count()) foreach($items as $item) {
$fieldItem = new TableListField_Item($item, $this);
if($items && $items->count()) foreach($items as $item) {
// create a TableListField_Item to support resolving of
// relation-fields in dot notation via TableListField_Item->Fields()
if($item) $fieldItems->push(new TableListField_Item($item, $this));
}
// temporary override to adjust TableListField_Item behaviour
$this->setFieldFormatting(array());
$this->setFieldEscape(array(
"\""=>"\"\"",
"\r\n"=>"",
"\r"=>"",
"\n"=>"",
));
$this->fieldList = $csvColumns;
if($fieldItems) {
foreach($fieldItems as $fieldItem) {
$fileData .= $fieldItem->renderwith("TableListField_Item_export");
$fields = $fieldItem->Fields();
foreach($fields as $field) {
$fileData .= "\"" . $field->Value . "\"";
if($field->Last()) {
$fileData .= "\n";
} else {
$fileData .= $this->csvSeparator;
}
}
}
HTTP::sendFileToBrowser($fileData, $fileName);
} else {
user_error("No records found", E_USER_ERROR);
@ -931,10 +947,6 @@ JS
$this->fieldFormatting = $formatting;
}
function setFieldEscape($escape){
$this->fieldEscape = $escape;
}
/**
* @return String
*/

View File

@ -358,6 +358,7 @@ $lang['en_US']['SimpleImageField']['NOUPLOAD'] = 'No Image Uploaded';
$lang['en_US']['TableField']['ISREQUIRED'] = 'In %s \'%s\' is required.';
$lang['en_US']['TableListField']['CSVEXPORT'] = 'Export to CSV';
$lang['en_US']['TableListField']['PRINT'] = 'Print';
$lang['en_US']['TableListField']['VREXPORT'] = 'Export to Vertical Response';
$lang['en_US']['ToggleField']['MORE'] = 'more';
$lang['en_US']['ToggleField']['LESS'] = 'less';
$lang['en_US']['DropdownField']['CHOOSE'] = array(
@ -636,13 +637,13 @@ $lang['en_US']['FieldEditor.ss']['CHECKBOXGROUP'] = 'Checkboxes';
$lang['en_US']['FieldEditor.ss']['MEMBERTITLE'] = 'Add member list field';
$lang['en_US']['FieldEditor.ss']['MEMBER'] = 'Member List';
$lang['en_US']['Image_iframe.ss']['TITLE'] = 'Image Uploading Iframe';
$lang['en_US']['TableListField_PageControls.ss']['VIEWLAST'] = 'View last';
$lang['en_US']['TableListField_PageControls.ss']['VIEWFIRST'] = 'View first';
$lang['en_US']['TableListField_PageControls.ss']['VIEWPREVIOUS'] = 'View previous';
$lang['en_US']['TableListField_PageControls.ss']['DISPLAYING'] = 'Displaying';
$lang['en_US']['TableListField_PageControls.ss']['TO'] = 'to';
$lang['en_US']['TableListField_PageControls.ss']['OF'] = 'of';
$lang['en_US']['TableListField_PageControls.ss']['VIEWNEXT'] = 'View next';
$lang['en_US']['TableListField_PageControls.ss']['VIEWLAST'] = 'View last';
$lang['en_US']['RelationComplexTableField.ss']['ADD'] = 'Add';
$lang['en_US']['RelationComplexTableField.ss']['SHOW'] = 'show';
$lang['en_US']['RelationComplexTableField.ss']['EDIT'] = 'edit';

View File

@ -8,6 +8,10 @@
* Security::set_login_recording(true);
* </code>
*
* Caution: Please make sure that enabling logging
* complies with your privacy standards. We're logging
* username and IP.
*
* @package sapphire
* @subpackage security
*/
@ -16,6 +20,7 @@ class LoginAttempt extends DataObject {
static $db = array(
'Email' => 'Varchar(255)',
'Status' => "Enum('Success,Failure')",
'IP' => 'Varchar(255)',
);
static $has_one = array(

View File

@ -49,6 +49,7 @@ class MemberAuthenticator extends Authenticator {
$attempt->Status = 'Failure';
}
$attempt->Email = $RAW_data['Email'];
$attempt->IP = Controller::curr()->getRequest()->getIP();
$attempt->write();
}