@@ -9,26 +9,26 @@ |
||
9 | 9 | |
10 | 10 | class SitemapPageTest extends FunctionalTest |
11 | 11 | { |
12 | - protected static $fixture_file = 'SitemapPageTest.yml'; |
|
12 | + protected static $fixture_file = 'SitemapPageTest.yml'; |
|
13 | 13 | |
14 | - protected static $use_draft_site = true; |
|
14 | + protected static $use_draft_site = true; |
|
15 | 15 | |
16 | - protected function setUp() |
|
17 | - { |
|
18 | - parent::setUp(); |
|
16 | + protected function setUp() |
|
17 | + { |
|
18 | + parent::setUp(); |
|
19 | 19 | |
20 | - Config::inst()->update(SSViewer::class, 'theme', 'starter'); |
|
21 | - } |
|
20 | + Config::inst()->update(SSViewer::class, 'theme', 'starter'); |
|
21 | + } |
|
22 | 22 | |
23 | - /** |
|
24 | - * Note: this test depends on the "starter" theme being installed and configured as default |
|
25 | - */ |
|
26 | - public function testSitemapShowsNavigationTitleNotNormalTitle() |
|
27 | - { |
|
28 | - $response = $this->get('sitemap'); |
|
29 | - $parser = new CSSContentParser($response->getBody()); |
|
30 | - $elements = $parser->getBySelector('.sitemap li.first .sitemap-link'); |
|
31 | - $this->assertNotEmpty($elements); |
|
32 | - $this->assertEquals('Top page nav 1', (string) $elements[0]); |
|
33 | - } |
|
23 | + /** |
|
24 | + * Note: this test depends on the "starter" theme being installed and configured as default |
|
25 | + */ |
|
26 | + public function testSitemapShowsNavigationTitleNotNormalTitle() |
|
27 | + { |
|
28 | + $response = $this->get('sitemap'); |
|
29 | + $parser = new CSSContentParser($response->getBody()); |
|
30 | + $elements = $parser->getBySelector('.sitemap li.first .sitemap-link'); |
|
31 | + $this->assertNotEmpty($elements); |
|
32 | + $this->assertEquals('Top page nav 1', (string) $elements[0]); |
|
33 | + } |
|
34 | 34 | } |
@@ -15,34 +15,34 @@ |
||
15 | 15 | class WorkflowDefinitionExtensionTest extends FunctionalTest |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @var Boolean If set to TRUE, this will force a test database to be generated |
|
20 | - * in {@link setUp()}. Note that this flag is overruled by the presence of a |
|
21 | - * {@link $fixture_file}, which always forces a database build. |
|
22 | - */ |
|
23 | - protected $usesDatabase = true; |
|
18 | + /** |
|
19 | + * @var Boolean If set to TRUE, this will force a test database to be generated |
|
20 | + * in {@link setUp()}. Note that this flag is overruled by the presence of a |
|
21 | + * {@link $fixture_file}, which always forces a database build. |
|
22 | + */ |
|
23 | + protected $usesDatabase = true; |
|
24 | 24 | |
25 | - /** |
|
26 | - * Tests the config option that controls the creation of a default workflow definition |
|
27 | - * |
|
28 | - * @return void |
|
29 | - */ |
|
30 | - public function testCreateDefaultWorkflowTest() |
|
31 | - { |
|
32 | - DB::quiet(); |
|
25 | + /** |
|
26 | + * Tests the config option that controls the creation of a default workflow definition |
|
27 | + * |
|
28 | + * @return void |
|
29 | + */ |
|
30 | + public function testCreateDefaultWorkflowTest() |
|
31 | + { |
|
32 | + DB::quiet(); |
|
33 | 33 | |
34 | - // test disabling the default workflow definition |
|
35 | - Config::modify()->set(CwpWorkflowDefinitionExtension::class, 'create_default_workflow', false); |
|
36 | - $workflowExtn = Injector::inst()->create(CwpWorkflowDefinitionExtension::class); |
|
37 | - $workflowExtn->requireDefaultRecords(); |
|
38 | - $definition = WorkflowDefinition::get()->first(); |
|
39 | - $this->assertNull($definition); |
|
34 | + // test disabling the default workflow definition |
|
35 | + Config::modify()->set(CwpWorkflowDefinitionExtension::class, 'create_default_workflow', false); |
|
36 | + $workflowExtn = Injector::inst()->create(CwpWorkflowDefinitionExtension::class); |
|
37 | + $workflowExtn->requireDefaultRecords(); |
|
38 | + $definition = WorkflowDefinition::get()->first(); |
|
39 | + $this->assertNull($definition); |
|
40 | 40 | |
41 | - // test enabling the default workflow definition |
|
42 | - Config::modify()->set(CwpWorkflowDefinitionExtension::class, 'create_default_workflow', true); |
|
43 | - $workflowExtn = Injector::inst()->create(CwpWorkflowDefinitionExtension::class); |
|
44 | - $workflowExtn->requireDefaultRecords(); |
|
45 | - $definition = WorkflowDefinition::get()->first(); |
|
46 | - $this->assertNotNull($definition); |
|
47 | - } |
|
41 | + // test enabling the default workflow definition |
|
42 | + Config::modify()->set(CwpWorkflowDefinitionExtension::class, 'create_default_workflow', true); |
|
43 | + $workflowExtn = Injector::inst()->create(CwpWorkflowDefinitionExtension::class); |
|
44 | + $workflowExtn->requireDefaultRecords(); |
|
45 | + $definition = WorkflowDefinition::get()->first(); |
|
46 | + $this->assertNotNull($definition); |
|
47 | + } |
|
48 | 48 | } |
@@ -7,51 +7,51 @@ discard block |
||
7 | 7 | |
8 | 8 | class SynonymValidatorTest extends SapphireTest |
9 | 9 | { |
10 | - /** |
|
11 | - * @var SynonymValidator |
|
12 | - */ |
|
13 | - protected $validator; |
|
10 | + /** |
|
11 | + * @var SynonymValidator |
|
12 | + */ |
|
13 | + protected $validator; |
|
14 | 14 | |
15 | - protected function setUp() |
|
16 | - { |
|
17 | - parent::setUp(); |
|
15 | + protected function setUp() |
|
16 | + { |
|
17 | + parent::setUp(); |
|
18 | 18 | |
19 | - $this->validator = new SynonymValidator([ |
|
20 | - 'Synonyms', |
|
21 | - ]); |
|
22 | - } |
|
19 | + $this->validator = new SynonymValidator([ |
|
20 | + 'Synonyms', |
|
21 | + ]); |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * @dataProvider validValuesProvider |
|
26 | - */ |
|
27 | - public function testItAllowsValidValues($value) |
|
28 | - { |
|
29 | - $this->validator->php([ |
|
30 | - 'Synonyms' => $value, |
|
31 | - ]); |
|
24 | + /** |
|
25 | + * @dataProvider validValuesProvider |
|
26 | + */ |
|
27 | + public function testItAllowsValidValues($value) |
|
28 | + { |
|
29 | + $this->validator->php([ |
|
30 | + 'Synonyms' => $value, |
|
31 | + ]); |
|
32 | 32 | |
33 | - $this->assertEmpty($this->validator->getErrors()); |
|
34 | - } |
|
33 | + $this->assertEmpty($this->validator->getErrors()); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * @return array |
|
38 | - */ |
|
39 | - public function validValuesProvider() |
|
40 | - { |
|
41 | - return [ |
|
42 | - ['foo'], |
|
43 | - ['foo,bar,baz'], |
|
44 | - ['foo, bar, baz'], |
|
45 | - [ |
|
46 | - ' |
|
36 | + /** |
|
37 | + * @return array |
|
38 | + */ |
|
39 | + public function validValuesProvider() |
|
40 | + { |
|
41 | + return [ |
|
42 | + ['foo'], |
|
43 | + ['foo,bar,baz'], |
|
44 | + ['foo, bar, baz'], |
|
45 | + [ |
|
46 | + ' |
|
47 | 47 | foo |
48 | 48 | bar |
49 | 49 | baz |
50 | 50 | ' |
51 | - ], |
|
52 | - ['foo => bar, baz'], |
|
53 | - [ |
|
54 | - ' |
|
51 | + ], |
|
52 | + ['foo => bar, baz'], |
|
53 | + [ |
|
54 | + ' |
|
55 | 55 | # this is a comment, it should be ignored! |
56 | 56 | |
57 | 57 | foo, bar, baz |
@@ -59,32 +59,32 @@ discard block |
||
59 | 59 | |
60 | 60 | # ...as should this. |
61 | 61 | ' |
62 | - ], |
|
63 | - ]; |
|
64 | - } |
|
62 | + ], |
|
63 | + ]; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @dataProvider invalidValuesProvider |
|
68 | - * |
|
69 | - * @param string $value |
|
70 | - */ |
|
71 | - public function testItDisallowsInvalidValues($value) |
|
72 | - { |
|
73 | - $this->validator->php([ |
|
74 | - 'Synonyms' => $value, |
|
75 | - ]); |
|
66 | + /** |
|
67 | + * @dataProvider invalidValuesProvider |
|
68 | + * |
|
69 | + * @param string $value |
|
70 | + */ |
|
71 | + public function testItDisallowsInvalidValues($value) |
|
72 | + { |
|
73 | + $this->validator->php([ |
|
74 | + 'Synonyms' => $value, |
|
75 | + ]); |
|
76 | 76 | |
77 | - $this->assertNotEmpty($this->validator->getErrors()); |
|
78 | - } |
|
77 | + $this->assertNotEmpty($this->validator->getErrors()); |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * @return array |
|
82 | - */ |
|
83 | - public function invalidValuesProvider() |
|
84 | - { |
|
85 | - return [ |
|
86 | - ['foo, bar baz, qux'], |
|
87 | - ['foo => bar baz, qux'], |
|
88 | - ]; |
|
89 | - } |
|
80 | + /** |
|
81 | + * @return array |
|
82 | + */ |
|
83 | + public function invalidValuesProvider() |
|
84 | + { |
|
85 | + return [ |
|
86 | + ['foo, bar baz, qux'], |
|
87 | + ['foo => bar baz, qux'], |
|
88 | + ]; |
|
89 | + } |
|
90 | 90 | } |
@@ -7,52 +7,52 @@ |
||
7 | 7 | |
8 | 8 | class NewsHolder extends DatedUpdateHolder |
9 | 9 | { |
10 | - private static $description = 'Container page for News Pages, provides news filtering and pagination'; |
|
11 | - |
|
12 | - private static $allowed_children = [ |
|
13 | - NewsPage::class, |
|
14 | - ]; |
|
15 | - |
|
16 | - private static $default_child = NewsPage::class; |
|
17 | - |
|
18 | - private static $update_name = 'News'; |
|
19 | - |
|
20 | - private static $update_class = NewsPage::class; |
|
21 | - |
|
22 | - private static $icon = 'cwp/cwp:images/icons/sitetree_images/news_listing.png'; |
|
23 | - |
|
24 | - public $pageIcon = 'images/icons/sitetree_images/news_listing.png'; |
|
25 | - |
|
26 | - private static $singular_name = 'News Holder'; |
|
27 | - |
|
28 | - private static $plural_name = 'News Holders'; |
|
29 | - |
|
30 | - private static $table_name = 'NewsHolder'; |
|
31 | - |
|
32 | - /** |
|
33 | - * Find all site's news items, based on some filters. |
|
34 | - * Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together. |
|
35 | - * |
|
36 | - * @param string $className The name of the class to fetch. |
|
37 | - * @param int $parentID The ID of the holder to extract the news items from. |
|
38 | - * @param int $tagID The ID of the tag to filter the news items by. |
|
39 | - * @param string $dateFrom The beginning of a date filter range. |
|
40 | - * @param string $dateTo The end of the date filter range. If empty, only one day will be searched for. |
|
41 | - * @param int $year Numeric value of the year to show. |
|
42 | - * @param int $monthNumber Numeric value of the month to show. |
|
43 | - * |
|
44 | - * @returns DataList|PaginatedList |
|
45 | - */ |
|
46 | - public static function AllUpdates( |
|
47 | - $className = NewsPage::class, |
|
48 | - $parentID = null, |
|
49 | - $tagID = null, |
|
50 | - $dateFrom = null, |
|
51 | - $dateTo = null, |
|
52 | - $year = null, |
|
53 | - $monthNumber = null |
|
54 | - ) { |
|
55 | - return parent::AllUpdates($className, $parentID, $tagID, $dateFrom, $dateTo, $year, $monthNumber) |
|
56 | - ->Sort('Date', 'DESC'); |
|
57 | - } |
|
10 | + private static $description = 'Container page for News Pages, provides news filtering and pagination'; |
|
11 | + |
|
12 | + private static $allowed_children = [ |
|
13 | + NewsPage::class, |
|
14 | + ]; |
|
15 | + |
|
16 | + private static $default_child = NewsPage::class; |
|
17 | + |
|
18 | + private static $update_name = 'News'; |
|
19 | + |
|
20 | + private static $update_class = NewsPage::class; |
|
21 | + |
|
22 | + private static $icon = 'cwp/cwp:images/icons/sitetree_images/news_listing.png'; |
|
23 | + |
|
24 | + public $pageIcon = 'images/icons/sitetree_images/news_listing.png'; |
|
25 | + |
|
26 | + private static $singular_name = 'News Holder'; |
|
27 | + |
|
28 | + private static $plural_name = 'News Holders'; |
|
29 | + |
|
30 | + private static $table_name = 'NewsHolder'; |
|
31 | + |
|
32 | + /** |
|
33 | + * Find all site's news items, based on some filters. |
|
34 | + * Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together. |
|
35 | + * |
|
36 | + * @param string $className The name of the class to fetch. |
|
37 | + * @param int $parentID The ID of the holder to extract the news items from. |
|
38 | + * @param int $tagID The ID of the tag to filter the news items by. |
|
39 | + * @param string $dateFrom The beginning of a date filter range. |
|
40 | + * @param string $dateTo The end of the date filter range. If empty, only one day will be searched for. |
|
41 | + * @param int $year Numeric value of the year to show. |
|
42 | + * @param int $monthNumber Numeric value of the month to show. |
|
43 | + * |
|
44 | + * @returns DataList|PaginatedList |
|
45 | + */ |
|
46 | + public static function AllUpdates( |
|
47 | + $className = NewsPage::class, |
|
48 | + $parentID = null, |
|
49 | + $tagID = null, |
|
50 | + $dateFrom = null, |
|
51 | + $dateTo = null, |
|
52 | + $year = null, |
|
53 | + $monthNumber = null |
|
54 | + ) { |
|
55 | + return parent::AllUpdates($className, $parentID, $tagID, $dateFrom, $dateTo, $year, $monthNumber) |
|
56 | + ->Sort('Date', 'DESC'); |
|
57 | + } |
|
58 | 58 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | |
22 | 22 | private static $icon = 'cwp/cwp:images/icons/sitetree_images/news_listing.png'; |
23 | 23 | |
24 | - public $pageIcon = 'images/icons/sitetree_images/news_listing.png'; |
|
24 | + public $pageIcon = 'images/icons/sitetree_images/news_listing.png'; |
|
25 | 25 | |
26 | 26 | private static $singular_name = 'News Holder'; |
27 | 27 |
@@ -7,59 +7,59 @@ |
||
7 | 7 | |
8 | 8 | class EventHolder extends DatedUpdateHolder |
9 | 9 | { |
10 | - private static $description = 'Container page for Event Pages, provides event filtering and pagination'; |
|
10 | + private static $description = 'Container page for Event Pages, provides event filtering and pagination'; |
|
11 | 11 | |
12 | - private static $allowed_children = [ |
|
13 | - EventPage::class, |
|
14 | - ]; |
|
12 | + private static $allowed_children = [ |
|
13 | + EventPage::class, |
|
14 | + ]; |
|
15 | 15 | |
16 | - private static $default_child = EventPage::class; |
|
16 | + private static $default_child = EventPage::class; |
|
17 | 17 | |
18 | - private static $update_name = 'Events'; |
|
18 | + private static $update_name = 'Events'; |
|
19 | 19 | |
20 | - private static $update_class = EventPage::class; |
|
20 | + private static $update_class = EventPage::class; |
|
21 | 21 | |
22 | - private static $icon = 'cwp/cwp:images/icons/sitetree_images/event_holder.png'; |
|
22 | + private static $icon = 'cwp/cwp:images/icons/sitetree_images/event_holder.png'; |
|
23 | 23 | |
24 | - public $pageIcon = 'images/icons/sitetree_images/event_holder.png'; |
|
24 | + public $pageIcon = 'images/icons/sitetree_images/event_holder.png'; |
|
25 | 25 | |
26 | - private static $singular_name = 'Event Holder'; |
|
26 | + private static $singular_name = 'Event Holder'; |
|
27 | 27 | |
28 | - private static $plural_name = 'Event Holders'; |
|
28 | + private static $plural_name = 'Event Holders'; |
|
29 | 29 | |
30 | - private static $table_name = 'EventHolder'; |
|
30 | + private static $table_name = 'EventHolder'; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Find all site's news items, based on some filters. |
|
34 | - * Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together. |
|
35 | - * |
|
36 | - * @param string $className The name of the class to fetch. |
|
37 | - * @param int $parentID The ID of the holder to extract the news items from. |
|
38 | - * @param int $tagID The ID of the tag to filter the news items by. |
|
39 | - * @param string $dateFrom The beginning of a date filter range. |
|
40 | - * @param string $dateTo The end of the date filter range. If empty, only one day will be searched for. |
|
41 | - * @param int $year Numeric value of the year to show. |
|
42 | - * @param int $monthNumber Numeric value of the month to show. |
|
43 | - * |
|
44 | - * @returns DataList|PaginatedList |
|
45 | - */ |
|
46 | - public static function AllUpdates( |
|
47 | - $className = 'Events', |
|
48 | - $parentID = null, |
|
49 | - $tagID = null, |
|
50 | - $dateFrom = null, |
|
51 | - $dateTo = null, |
|
52 | - $year = null, |
|
53 | - $monthNumber = null |
|
54 | - ) { |
|
55 | - return parent::AllUpdates( |
|
56 | - $className, |
|
57 | - $parentID, |
|
58 | - $tagID, |
|
59 | - $dateFrom, |
|
60 | - $dateTo, |
|
61 | - $year, |
|
62 | - $monthNumber |
|
63 | - )->Sort('Date', 'ASC'); |
|
64 | - } |
|
32 | + /** |
|
33 | + * Find all site's news items, based on some filters. |
|
34 | + * Omitting parameters will prevent relevant filters from being applied. The filters are ANDed together. |
|
35 | + * |
|
36 | + * @param string $className The name of the class to fetch. |
|
37 | + * @param int $parentID The ID of the holder to extract the news items from. |
|
38 | + * @param int $tagID The ID of the tag to filter the news items by. |
|
39 | + * @param string $dateFrom The beginning of a date filter range. |
|
40 | + * @param string $dateTo The end of the date filter range. If empty, only one day will be searched for. |
|
41 | + * @param int $year Numeric value of the year to show. |
|
42 | + * @param int $monthNumber Numeric value of the month to show. |
|
43 | + * |
|
44 | + * @returns DataList|PaginatedList |
|
45 | + */ |
|
46 | + public static function AllUpdates( |
|
47 | + $className = 'Events', |
|
48 | + $parentID = null, |
|
49 | + $tagID = null, |
|
50 | + $dateFrom = null, |
|
51 | + $dateTo = null, |
|
52 | + $year = null, |
|
53 | + $monthNumber = null |
|
54 | + ) { |
|
55 | + return parent::AllUpdates( |
|
56 | + $className, |
|
57 | + $parentID, |
|
58 | + $tagID, |
|
59 | + $dateFrom, |
|
60 | + $dateTo, |
|
61 | + $year, |
|
62 | + $monthNumber |
|
63 | + )->Sort('Date', 'ASC'); |
|
64 | + } |
|
65 | 65 | } |
@@ -12,83 +12,83 @@ |
||
12 | 12 | |
13 | 13 | class EventPage extends DatedUpdatePage |
14 | 14 | { |
15 | - private static $description = 'Describes an event occurring on a specific date.'; |
|
15 | + private static $description = 'Describes an event occurring on a specific date.'; |
|
16 | 16 | |
17 | - private static $default_parent = EventHolder::class; |
|
17 | + private static $default_parent = EventHolder::class; |
|
18 | 18 | |
19 | - private static $can_be_root = false; |
|
19 | + private static $can_be_root = false; |
|
20 | 20 | |
21 | - private static $icon = 'cwp/cwp:images/icons/sitetree_images/event_page.png'; |
|
21 | + private static $icon = 'cwp/cwp:images/icons/sitetree_images/event_page.png'; |
|
22 | 22 | |
23 | - public $pageIcon = 'images/icons/sitetree_images/event_page.png'; |
|
23 | + public $pageIcon = 'images/icons/sitetree_images/event_page.png'; |
|
24 | 24 | |
25 | - private static $singular_name = 'Event Page'; |
|
25 | + private static $singular_name = 'Event Page'; |
|
26 | 26 | |
27 | - private static $plural_name = 'Event Pages'; |
|
27 | + private static $plural_name = 'Event Pages'; |
|
28 | 28 | |
29 | - private static $db = [ |
|
30 | - 'StartTime' => 'Time', |
|
31 | - 'EndTime' => 'Time', |
|
32 | - 'Location' => 'Text', |
|
33 | - ]; |
|
29 | + private static $db = [ |
|
30 | + 'StartTime' => 'Time', |
|
31 | + 'EndTime' => 'Time', |
|
32 | + 'Location' => 'Text', |
|
33 | + ]; |
|
34 | 34 | |
35 | - private static $table_name = 'EventPage'; |
|
35 | + private static $table_name = 'EventPage'; |
|
36 | 36 | |
37 | - public function fieldLabels($includerelations = true) |
|
38 | - { |
|
39 | - $labels = parent::fieldLabels($includerelations); |
|
40 | - $labels['StartTime'] = _t('DateUpdatePage.StartTimeFieldLabel', 'Start Time'); |
|
41 | - $labels['EndTime'] = _t('DateUpdatePage.EndTimeFieldLabel', 'End Time'); |
|
42 | - $labels['Location'] = _t('DateUpdatePage.LocationFieldLabel', 'Location'); |
|
37 | + public function fieldLabels($includerelations = true) |
|
38 | + { |
|
39 | + $labels = parent::fieldLabels($includerelations); |
|
40 | + $labels['StartTime'] = _t('DateUpdatePage.StartTimeFieldLabel', 'Start Time'); |
|
41 | + $labels['EndTime'] = _t('DateUpdatePage.EndTimeFieldLabel', 'End Time'); |
|
42 | + $labels['Location'] = _t('DateUpdatePage.LocationFieldLabel', 'Location'); |
|
43 | 43 | |
44 | - return $labels; |
|
45 | - } |
|
44 | + return $labels; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Add the default for the Date being the current day. |
|
49 | - */ |
|
50 | - public function populateDefaults() |
|
51 | - { |
|
52 | - if (!isset($this->Date) || $this->Date === null) { |
|
53 | - $this->Date = DBDatetime::now()->Format('y-MM-dd'); |
|
54 | - } |
|
47 | + /** |
|
48 | + * Add the default for the Date being the current day. |
|
49 | + */ |
|
50 | + public function populateDefaults() |
|
51 | + { |
|
52 | + if (!isset($this->Date) || $this->Date === null) { |
|
53 | + $this->Date = DBDatetime::now()->Format('y-MM-dd'); |
|
54 | + } |
|
55 | 55 | |
56 | - if (!isset($this->StartTime) || $this->StartTime === null) { |
|
57 | - $this->StartTime = '09:00:00'; |
|
58 | - } |
|
56 | + if (!isset($this->StartTime) || $this->StartTime === null) { |
|
57 | + $this->StartTime = '09:00:00'; |
|
58 | + } |
|
59 | 59 | |
60 | - if (!isset($this->EndTime) || $this->EndTime === null) { |
|
61 | - $this->EndTime = '17:00:00'; |
|
62 | - } |
|
60 | + if (!isset($this->EndTime) || $this->EndTime === null) { |
|
61 | + $this->EndTime = '17:00:00'; |
|
62 | + } |
|
63 | 63 | |
64 | - parent::populateDefaults(); |
|
65 | - } |
|
64 | + parent::populateDefaults(); |
|
65 | + } |
|
66 | 66 | |
67 | - public function getCMSFields() |
|
68 | - { |
|
69 | - $this->beforeUpdateCMSFields(function (FieldList $fields) { |
|
70 | - $fields->removeByName('Date'); |
|
67 | + public function getCMSFields() |
|
68 | + { |
|
69 | + $this->beforeUpdateCMSFields(function (FieldList $fields) { |
|
70 | + $fields->removeByName('Date'); |
|
71 | 71 | |
72 | - $dateTimeFields = array(); |
|
72 | + $dateTimeFields = array(); |
|
73 | 73 | |
74 | - $dateTimeFields[] = $dateField = DateField::create('Date', 'Date'); |
|
75 | - $dateTimeFields[] = $startTimeField = TimeField::create( |
|
76 | - 'StartTime', |
|
77 | - ' ' . $this->fieldLabel('StartTime') |
|
78 | - ); |
|
79 | - $dateTimeFields[] = $endTimeField = TimeField::create('EndTime', $this->fieldLabel('EndTime')); |
|
74 | + $dateTimeFields[] = $dateField = DateField::create('Date', 'Date'); |
|
75 | + $dateTimeFields[] = $startTimeField = TimeField::create( |
|
76 | + 'StartTime', |
|
77 | + ' ' . $this->fieldLabel('StartTime') |
|
78 | + ); |
|
79 | + $dateTimeFields[] = $endTimeField = TimeField::create('EndTime', $this->fieldLabel('EndTime')); |
|
80 | 80 | |
81 | - $fields->addFieldsToTab('Root.Main', [ |
|
82 | - $dateTimeField = FieldGroup::create('Date and time', $dateTimeFields), |
|
83 | - $locationField = TextareaField::create('Location', $this->fieldLabel('Location')) |
|
84 | - ], 'Abstract'); |
|
85 | - $locationField->setRows(4); |
|
86 | - }); |
|
87 | - return parent::getCMSFields(); |
|
88 | - } |
|
81 | + $fields->addFieldsToTab('Root.Main', [ |
|
82 | + $dateTimeField = FieldGroup::create('Date and time', $dateTimeFields), |
|
83 | + $locationField = TextareaField::create('Location', $this->fieldLabel('Location')) |
|
84 | + ], 'Abstract'); |
|
85 | + $locationField->setRows(4); |
|
86 | + }); |
|
87 | + return parent::getCMSFields(); |
|
88 | + } |
|
89 | 89 | |
90 | - public function NiceLocation() |
|
91 | - { |
|
92 | - return nl2br(Convert::raw2xml($this->Location), true); |
|
93 | - } |
|
90 | + public function NiceLocation() |
|
91 | + { |
|
92 | + return nl2br(Convert::raw2xml($this->Location), true); |
|
93 | + } |
|
94 | 94 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | private static $icon = 'cwp/cwp:images/icons/sitetree_images/event_page.png'; |
22 | 22 | |
23 | - public $pageIcon = 'images/icons/sitetree_images/event_page.png'; |
|
23 | + public $pageIcon = 'images/icons/sitetree_images/event_page.png'; |
|
24 | 24 | |
25 | 25 | private static $singular_name = 'Event Page'; |
26 | 26 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | public function getCMSFields() |
68 | 68 | { |
69 | - $this->beforeUpdateCMSFields(function (FieldList $fields) { |
|
69 | + $this->beforeUpdateCMSFields(function(FieldList $fields) { |
|
70 | 70 | $fields->removeByName('Date'); |
71 | 71 | |
72 | 72 | $dateTimeFields = array(); |
@@ -7,30 +7,30 @@ |
||
7 | 7 | |
8 | 8 | class NewsHolderController extends DatedUpdateHolderController |
9 | 9 | { |
10 | - private static $allowed_actions = [ |
|
11 | - 'rss', |
|
12 | - 'atom', |
|
13 | - ]; |
|
10 | + private static $allowed_actions = [ |
|
11 | + 'rss', |
|
12 | + 'atom', |
|
13 | + ]; |
|
14 | 14 | |
15 | - public function rss() |
|
16 | - { |
|
17 | - $rss = RSSFeed::create( |
|
18 | - $this->Updates()->sort('Created DESC')->limit(20), |
|
19 | - $this->Link('rss'), |
|
20 | - $this->getSubscriptionTitle() |
|
21 | - ); |
|
22 | - $rss->setTemplate('CWP\\CWP\\PageTypes\\NewsHolder_rss'); |
|
23 | - return $rss->outputToBrowser(); |
|
24 | - } |
|
15 | + public function rss() |
|
16 | + { |
|
17 | + $rss = RSSFeed::create( |
|
18 | + $this->Updates()->sort('Created DESC')->limit(20), |
|
19 | + $this->Link('rss'), |
|
20 | + $this->getSubscriptionTitle() |
|
21 | + ); |
|
22 | + $rss->setTemplate('CWP\\CWP\\PageTypes\\NewsHolder_rss'); |
|
23 | + return $rss->outputToBrowser(); |
|
24 | + } |
|
25 | 25 | |
26 | - public function atom() |
|
27 | - { |
|
28 | - $atom = CwpAtomFeed::create( |
|
29 | - $this->Updates()->sort('Created DESC')->limit(20), |
|
30 | - $this->Link('atom'), |
|
31 | - $this->getSubscriptionTitle() |
|
32 | - ); |
|
33 | - $atom->setTemplate('CWP\\CWP\\PageTypes\\NewsHolder_atom'); |
|
34 | - return $atom->outputToBrowser(); |
|
35 | - } |
|
26 | + public function atom() |
|
27 | + { |
|
28 | + $atom = CwpAtomFeed::create( |
|
29 | + $this->Updates()->sort('Created DESC')->limit(20), |
|
30 | + $this->Link('atom'), |
|
31 | + $this->getSubscriptionTitle() |
|
32 | + ); |
|
33 | + $atom->setTemplate('CWP\\CWP\\PageTypes\\NewsHolder_atom'); |
|
34 | + return $atom->outputToBrowser(); |
|
35 | + } |
|
36 | 36 | } |
@@ -12,45 +12,45 @@ |
||
12 | 12 | class CwpSearchBoostExtension extends DataExtension |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Quality to boost the 'SearchBoost' field by. |
|
17 | - * Default boost is 2x |
|
18 | - * |
|
19 | - * @config |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - private static $search_boost = '2'; |
|
23 | - |
|
24 | - private static $db = array( |
|
25 | - 'SearchBoost' => 'Text' |
|
26 | - ); |
|
27 | - |
|
28 | - /** |
|
29 | - * Adds boost fields to this page |
|
30 | - * |
|
31 | - * @param FieldList $fields |
|
32 | - */ |
|
33 | - public function updateCMSFields(FieldList $fields) |
|
34 | - { |
|
35 | - parent::updateCMSFields($fields); |
|
36 | - |
|
37 | - // Rename metafield |
|
38 | - $meta = $fields->fieldByName('Root.Main.Metadata'); |
|
39 | - $meta->setTitle(_t('CwpSearchBoostExtension.PAGEINFO', 'Page info and SEO')); |
|
40 | - |
|
41 | - $boostTitle = _t('CwpSiteTreeSearchBoost.SearchBoost', 'Boost Keywords'); |
|
42 | - $boostNote = _t( |
|
43 | - 'CwpSiteTreeSearchBoost.SearchBoostNote', |
|
44 | - '(Only applies to the search results on this site e.g. not on Google search)' |
|
45 | - ); |
|
46 | - $boostDescription = _t( |
|
47 | - 'CwpSiteTreeSearchBoost.SearchBoostDescription', |
|
48 | - 'Enter keywords separated by comma ( , ) for which to boost the ranking of this page ' |
|
49 | - . 'within the search results on this site.' |
|
50 | - ); |
|
51 | - $boostField = TextareaField::create('SearchBoost', $boostTitle) |
|
52 | - ->setRightTitle($boostNote) |
|
53 | - ->setDescription($boostDescription); |
|
54 | - $fields->insertBefore($boostField, 'MetaDescription'); |
|
55 | - } |
|
15 | + /** |
|
16 | + * Quality to boost the 'SearchBoost' field by. |
|
17 | + * Default boost is 2x |
|
18 | + * |
|
19 | + * @config |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + private static $search_boost = '2'; |
|
23 | + |
|
24 | + private static $db = array( |
|
25 | + 'SearchBoost' => 'Text' |
|
26 | + ); |
|
27 | + |
|
28 | + /** |
|
29 | + * Adds boost fields to this page |
|
30 | + * |
|
31 | + * @param FieldList $fields |
|
32 | + */ |
|
33 | + public function updateCMSFields(FieldList $fields) |
|
34 | + { |
|
35 | + parent::updateCMSFields($fields); |
|
36 | + |
|
37 | + // Rename metafield |
|
38 | + $meta = $fields->fieldByName('Root.Main.Metadata'); |
|
39 | + $meta->setTitle(_t('CwpSearchBoostExtension.PAGEINFO', 'Page info and SEO')); |
|
40 | + |
|
41 | + $boostTitle = _t('CwpSiteTreeSearchBoost.SearchBoost', 'Boost Keywords'); |
|
42 | + $boostNote = _t( |
|
43 | + 'CwpSiteTreeSearchBoost.SearchBoostNote', |
|
44 | + '(Only applies to the search results on this site e.g. not on Google search)' |
|
45 | + ); |
|
46 | + $boostDescription = _t( |
|
47 | + 'CwpSiteTreeSearchBoost.SearchBoostDescription', |
|
48 | + 'Enter keywords separated by comma ( , ) for which to boost the ranking of this page ' |
|
49 | + . 'within the search results on this site.' |
|
50 | + ); |
|
51 | + $boostField = TextareaField::create('SearchBoost', $boostTitle) |
|
52 | + ->setRightTitle($boostNote) |
|
53 | + ->setDescription($boostDescription); |
|
54 | + $fields->insertBefore($boostField, 'MetaDescription'); |
|
55 | + } |
|
56 | 56 | } |
@@ -11,50 +11,50 @@ |
||
11 | 11 | class CwpSiteTreeFileExtension extends DataExtension |
12 | 12 | { |
13 | 13 | |
14 | - public function updateCMSFields(FieldList $fields) |
|
15 | - { |
|
16 | - Requirements::css('cwp/cwp:css/fieldDescriptionToggle.css'); |
|
17 | - Requirements::javascript('cwp/cwp:javascript/fieldDescriptionToggle.js'); |
|
18 | - |
|
19 | - $fields->insertAfter( |
|
20 | - ReadonlyField::create( |
|
21 | - 'BackLinkCount', |
|
22 | - _t('AssetTableField.BACKLINKCOUNT', 'Used on:'), |
|
23 | - $this->owner->BackLinkTracking()->Count() . ' ' . _t('AssetTableField.PAGES', 'page(s)') |
|
24 | - ) |
|
25 | - ->addExtraClass('cms-description-toggle') |
|
26 | - ->setDescription($this->BackLinkHTMLList()), |
|
27 | - 'LastEdited' |
|
28 | - ); |
|
29 | - } |
|
30 | - |
|
31 | - /** |
|
32 | - * Generate an HTML list which provides links to where a file is used. |
|
33 | - * |
|
34 | - * @return String |
|
35 | - */ |
|
36 | - public function BackLinkHTMLList() |
|
37 | - { |
|
38 | - $html = '<em>' . _t( |
|
39 | - 'SiteTreeFileExtension.BACKLINK_LIST_DESCRIPTION', |
|
40 | - 'This list shows all pages where the file has been added through a WYSIWYG editor.' |
|
41 | - ) . '</em>'; |
|
42 | - $html .= '<ul>'; |
|
43 | - |
|
44 | - foreach ($this->owner->BackLinkTracking() as $backLink) { |
|
45 | - $listItem = '<li>'; |
|
46 | - |
|
47 | - // Add the page link |
|
48 | - $listItem .= '<a href="' . $backLink->Link() . '" target="_blank">' |
|
49 | - . Convert::raw2xml($backLink->MenuTitle) . '</a> – '; |
|
50 | - |
|
51 | - // Add the CMS link |
|
52 | - $listItem .= '<a href="' . $backLink->CMSEditLink() . '">' |
|
53 | - . _t('SiteTreeFileExtension.EDIT', 'Edit') . '</a>'; |
|
54 | - |
|
55 | - $html .= $listItem . '</li>'; |
|
56 | - } |
|
57 | - |
|
58 | - return $html .= '</ul>'; |
|
59 | - } |
|
14 | + public function updateCMSFields(FieldList $fields) |
|
15 | + { |
|
16 | + Requirements::css('cwp/cwp:css/fieldDescriptionToggle.css'); |
|
17 | + Requirements::javascript('cwp/cwp:javascript/fieldDescriptionToggle.js'); |
|
18 | + |
|
19 | + $fields->insertAfter( |
|
20 | + ReadonlyField::create( |
|
21 | + 'BackLinkCount', |
|
22 | + _t('AssetTableField.BACKLINKCOUNT', 'Used on:'), |
|
23 | + $this->owner->BackLinkTracking()->Count() . ' ' . _t('AssetTableField.PAGES', 'page(s)') |
|
24 | + ) |
|
25 | + ->addExtraClass('cms-description-toggle') |
|
26 | + ->setDescription($this->BackLinkHTMLList()), |
|
27 | + 'LastEdited' |
|
28 | + ); |
|
29 | + } |
|
30 | + |
|
31 | + /** |
|
32 | + * Generate an HTML list which provides links to where a file is used. |
|
33 | + * |
|
34 | + * @return String |
|
35 | + */ |
|
36 | + public function BackLinkHTMLList() |
|
37 | + { |
|
38 | + $html = '<em>' . _t( |
|
39 | + 'SiteTreeFileExtension.BACKLINK_LIST_DESCRIPTION', |
|
40 | + 'This list shows all pages where the file has been added through a WYSIWYG editor.' |
|
41 | + ) . '</em>'; |
|
42 | + $html .= '<ul>'; |
|
43 | + |
|
44 | + foreach ($this->owner->BackLinkTracking() as $backLink) { |
|
45 | + $listItem = '<li>'; |
|
46 | + |
|
47 | + // Add the page link |
|
48 | + $listItem .= '<a href="' . $backLink->Link() . '" target="_blank">' |
|
49 | + . Convert::raw2xml($backLink->MenuTitle) . '</a> – '; |
|
50 | + |
|
51 | + // Add the CMS link |
|
52 | + $listItem .= '<a href="' . $backLink->CMSEditLink() . '">' |
|
53 | + . _t('SiteTreeFileExtension.EDIT', 'Edit') . '</a>'; |
|
54 | + |
|
55 | + $html .= $listItem . '</li>'; |
|
56 | + } |
|
57 | + |
|
58 | + return $html .= '</ul>'; |
|
59 | + } |
|
60 | 60 | } |