mirror of
https://github.com/silverstripe/silverstripe-versionfeed
synced 2024-10-22 11:05:31 +02:00
FIX Add warnings as descriptions to settings tabs, not literal fields. Remove duplicated translation
This commit is contained in:
parent
952b67a5cb
commit
6b6f4ec622
@ -9,4 +9,3 @@ en:
|
|||||||
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
SilverStripe\VersionFeed\VersionFeedSiteConfig:
|
||||||
ALLCHANGES: 'All page changes'
|
ALLCHANGES: 'All page changes'
|
||||||
ALLCHANGESLABEL: 'Make global changes feed public'
|
ALLCHANGESLABEL: 'Make global changes feed public'
|
||||||
Warning: 'Publicising the history will also disclose the changes that have at the time been protected from the public view.'
|
|
||||||
|
@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
namespace SilverStripe\VersionFeed;
|
namespace SilverStripe\VersionFeed;
|
||||||
|
|
||||||
use SilverStripe\ORM\FieldType\DBField;
|
use SilverStripe\CMS\Model\SiteTreeExtension;
|
||||||
use SilverStripe\View\Parsers\Diff;
|
|
||||||
use SilverStripe\ORM\ArrayList;
|
|
||||||
use SilverStripe\Forms\FieldList;
|
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Forms\CheckboxField;
|
use SilverStripe\Forms\CheckboxField;
|
||||||
use SilverStripe\Forms\FieldGroup;
|
use SilverStripe\Forms\FieldGroup;
|
||||||
use SilverStripe\Forms\LiteralField;
|
use SilverStripe\Forms\FieldList;
|
||||||
|
use SilverStripe\ORM\ArrayList;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
use SilverStripe\SiteConfig\SiteConfig;
|
use SilverStripe\SiteConfig\SiteConfig;
|
||||||
use SilverStripe\CMS\Model\SiteTreeExtension;
|
use SilverStripe\View\Parsers\Diff;
|
||||||
|
|
||||||
class VersionFeed extends SiteTreeExtension
|
class VersionFeed extends SiteTreeExtension
|
||||||
{
|
{
|
||||||
@ -146,7 +146,7 @@ class VersionFeed extends SiteTreeExtension
|
|||||||
* Return a single diff representing this version.
|
* Return a single diff representing this version.
|
||||||
* Returns the initial version if there is nothing to compare to.
|
* Returns the initial version if there is nothing to compare to.
|
||||||
*
|
*
|
||||||
* @returns DataObject Object with relevant fields diffed.
|
* @return DataObject|null Object with relevant fields diffed.
|
||||||
*/
|
*/
|
||||||
public function getDiff()
|
public function getDiff()
|
||||||
{
|
{
|
||||||
@ -179,32 +179,34 @@ class VersionFeed extends SiteTreeExtension
|
|||||||
|
|
||||||
public function updateSettingsFields(FieldList $fields)
|
public function updateSettingsFields(FieldList $fields)
|
||||||
{
|
{
|
||||||
if (!Config::inst()->get(get_class(), 'changes_enabled')) {
|
if (!$this->owner->config()->get('changes_enabled')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add public history field.
|
// Add public history field.
|
||||||
$fields->addFieldToTab('Root.Settings', $publicHistory = new FieldGroup(
|
$fields->addFieldToTab(
|
||||||
new CheckboxField('PublicHistory', $this->owner->fieldLabel('PublicHistory'))
|
'Root.Settings',
|
||||||
));
|
$publicHistory = FieldGroup::create(
|
||||||
|
CheckboxField::create('PublicHistory', $this->owner->fieldLabel('PublicHistory'))
|
||||||
$warning = _t(
|
)
|
||||||
|
->setDescription(_t(
|
||||||
__CLASS__ . '.Warning',
|
__CLASS__ . '.Warning',
|
||||||
"Publicising the history will also disclose the changes that have at the time been protected " .
|
"Publicising the history will also disclose the changes that have at the "
|
||||||
"from the public view."
|
. "time been protected from the public view."
|
||||||
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
$fields->addFieldToTab('Root.Settings', new LiteralField('PublicHistoryWarning', $warning), 'PublicHistory');
|
if ($this->owner->CanViewType != 'Anyone') {
|
||||||
|
$canViewType = $fields->fieldByName('Root.Settings.CanViewType');
|
||||||
if ($this->owner->CanViewType!='Anyone') {
|
if ($canViewType) {
|
||||||
$warning = _t(
|
$canViewType->setDescription(_t(
|
||||||
__CLASS__ . '.Warning2',
|
__CLASS__ . '.Warning2',
|
||||||
"Changing access settings in such a way that this page or pages under it become publicly<br>" .
|
"Changing access settings in such a way that this page or pages under it become publicly<br>"
|
||||||
"accessible may result in publicising all historical changes on these pages too. Please review<br>" .
|
. "accessible may result in publicising all historical changes on these pages too. Please review"
|
||||||
"this section's \"Public history\" settings to ascertain only intended information is disclosed."
|
. "<br> this section's \"Public history\" settings to ascertain only intended information is "
|
||||||
);
|
. "disclosed."
|
||||||
|
));
|
||||||
$fields->addFieldToTab('Root.Settings', new LiteralField('PublicHistoryWarning2', $warning), 'CanViewType');
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,11 +2,10 @@
|
|||||||
|
|
||||||
namespace SilverStripe\VersionFeed;
|
namespace SilverStripe\VersionFeed;
|
||||||
|
|
||||||
use SilverStripe\Forms\FieldList;
|
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\VersionFeed\VersionFeed;
|
|
||||||
use SilverStripe\Forms\CheckboxField;
|
use SilverStripe\Forms\CheckboxField;
|
||||||
use SilverStripe\Forms\FieldGroup;
|
use SilverStripe\Forms\FieldGroup;
|
||||||
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\ORM\DataExtension;
|
use SilverStripe\ORM\DataExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,7 +38,7 @@ class VersionFeedSiteConfig extends DataExtension
|
|||||||
FieldGroup::create(new CheckboxField('AllChangesEnabled', $this->owner->fieldLabel('AllChangesEnabled')))
|
FieldGroup::create(new CheckboxField('AllChangesEnabled', $this->owner->fieldLabel('AllChangesEnabled')))
|
||||||
->setTitle(_t(__CLASS__ . '.ALLCHANGES', 'All page changes'))
|
->setTitle(_t(__CLASS__ . '.ALLCHANGES', 'All page changes'))
|
||||||
->setDescription(_t(
|
->setDescription(_t(
|
||||||
__CLASS__ . '.Warning',
|
'SilverStripe\\VersionFeed\\VersionFeed.Warning',
|
||||||
"Publicising the history will also disclose the changes that have at the time been protected " .
|
"Publicising the history will also disclose the changes that have at the time been protected " .
|
||||||
"from the public view."
|
"from the public view."
|
||||||
))
|
))
|
||||||
|
Loading…
Reference in New Issue
Block a user