Mod - added threshold for member gridfield cutoff
This commit is contained in:
parent
418307aa04
commit
6f5a960620
|
@ -1,4 +1,5 @@
|
|||
SiteTree:
|
||||
content_review_gridfield_threshold: 500
|
||||
extensions:
|
||||
- SiteTreeContentReview
|
||||
Group:
|
||||
|
|
|
@ -112,13 +112,29 @@ class ContentReviewDefaultSettings extends DataExtension
|
|||
|
||||
$fields->addFieldToTab('Root.ContentReview', $reviewFrequency);
|
||||
|
||||
$gridfieldconfig = GridFieldConfig_RelationEditor::create();
|
||||
$gridfieldconfig->removeComponentsByType(new GridFieldAddNewButton());
|
||||
$gridfield = GridField::create('OwnerUsers', _t("ContentReview.PAGEOWNERUSERS", "Users"),
|
||||
$this->OwnerUsers()->Sort('FirstName'), $gridfieldconfig)
|
||||
->setDescription(_t('ContentReview.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews'));
|
||||
$users = Permission::get_members_by_permission(array(
|
||||
'CMS_ACCESS_CMSMain',
|
||||
'ADMIN',
|
||||
));
|
||||
|
||||
$fields->addFieldToTab('Root.ContentReview', $gridfield);
|
||||
$usersMap = $users->map('ID', 'Title')->toArray();
|
||||
asort($usersMap);
|
||||
|
||||
$userField = ListboxField::create('OwnerUsers', _t('ContentReview.PAGEOWNERUSERS', 'Users'), $usersMap)
|
||||
->setMultiple(true)
|
||||
->setAttribute('data-placeholder', _t('ContentReview.ADDUSERS', 'Add users'))
|
||||
->setDescription(_t('ContentReview.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews'));
|
||||
|
||||
|
||||
if(Member::get()->count() > Config::inst()->get('SiteTree', 'content_review_gridfield_threshold')) {
|
||||
$gridfieldconfig = GridFieldConfig_RelationEditor::create();
|
||||
$gridfieldconfig->removeComponentsByType(new GridFieldAddNewButton());
|
||||
$userField = GridField::create('OwnerUsers', _t("ContentReview.PAGEOWNERUSERS", "Users"),
|
||||
$this->OwnerUsers()->Sort('FirstName'), $gridfieldconfig)
|
||||
->setDescription(_t('ContentReview.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews'));
|
||||
}
|
||||
|
||||
$fields->addFieldToTab('Root.ContentReview', $userField);
|
||||
|
||||
$groupsMap = array();
|
||||
|
||||
|
|
|
@ -344,12 +344,25 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||
|
||||
$viewersOptionsField = OptionsetField::create("ContentReviewType", _t("ContentReview.OPTIONS", "Options"), $options);
|
||||
|
||||
$gridfieldconfig = GridFieldConfig_RelationEditor::create();
|
||||
$gridfieldconfig->removeComponentsByType(new GridFieldAddNewButton());
|
||||
$userField = GridField::create('OwnerUsers', _t("ContentReview.PAGEOWNERUSERS", "Users"),
|
||||
$this->OwnerUsers(), $gridfieldconfig)
|
||||
$users = Permission::get_members_by_permission(array("CMS_ACCESS_CMSMain", "ADMIN"));
|
||||
$usersMap = $users->map("ID", "Title")->toArray();
|
||||
asort($usersMap);
|
||||
$userField = ListboxField::create("OwnerUsers", _t("ContentReview.PAGEOWNERUSERS", "Users"), $usersMap)
|
||||
->setMultiple(true)
|
||||
->addExtraClass('custom-setting')
|
||||
->setAttribute("data-placeholder", _t("ContentReview.ADDUSERS", "Add users"))
|
||||
->setDescription(_t('ContentReview.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews'));
|
||||
|
||||
if(Member::get()->count() > Config::inst()->get('SiteTree', 'content_review_gridfield_threshold')) {
|
||||
// grid field for large numbers of users
|
||||
$gridfieldconfig = GridFieldConfig_RelationEditor::create();
|
||||
$gridfieldconfig->removeComponentsByType(new GridFieldAddNewButton());
|
||||
$userField = GridField::create('OwnerUsers', _t("ContentReview.PAGEOWNERUSERS", "Users"),
|
||||
$this->OwnerUsers(), $gridfieldconfig)
|
||||
->setDescription(_t('ContentReview.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews'));
|
||||
}
|
||||
|
||||
|
||||
$groupsMap = array();
|
||||
|
||||
foreach (Group::get() as $group) {
|
||||
|
|
|
@ -22,4 +22,15 @@ To set a content review schedule for a page go to `Settings > Content Review`.
|
|||
CMS users without the permission to change the content review schedule can still see the settings
|
||||
and previous reviews in the same view, but cannot change anything.
|
||||
|
||||
![](_images/content-review-settings-ro.png)
|
||||
![](_images/content-review-settings-ro.png)
|
||||
|
||||
## If your database contains a large number of members
|
||||
|
||||
The page owners selector will change from a ListboxField to a Gridfield in order
|
||||
to prevent your browser from crashing. By default this numbers is 500. You can
|
||||
customise this threshold by editing your .yml with the following settings:
|
||||
|
||||
```
|
||||
SiteTree:
|
||||
content_review_gridfield_threshold: 500
|
||||
```
|
Loading…
Reference in New Issue