19
19
class COALandingPage extends Page
20
20
{
21
21
static $ db = array (
22
- 'BannerText ' => 'HTMLText ' ,
23
- 'ExamDetails ' => 'HTMLText ' ,
24
- 'HandBookLink ' => 'Text ' ,
22
+ 'BannerText ' => 'HTMLText ' ,
23
+ 'ExamDetails ' => 'HTMLText ' ,
24
+ 'HandBookLink ' => 'Text ' ,
25
+ 'GetStartedURL ' => 'Text ' ,
26
+ 'AlreadyRegisteredURL ' => 'Text ' ,
25
27
);
26
28
27
29
static $ has_one = array
28
30
(
29
-
31
+ ' HeroImage ' => ' BetterImage ' ,
30
32
);
31
33
32
34
static $ many_many = array
@@ -51,7 +53,6 @@ public function getBannerText(){
51
53
return $ html ;
52
54
}
53
55
54
-
55
56
public function getExamDetails (){
56
57
$ html = $ this ->getField ('ExamDetails ' );
57
58
if (empty ($ html )){
@@ -72,6 +73,30 @@ public function getHandBookLink(){
72
73
return $ html ;
73
74
}
74
75
76
+ public function getGetStartedURL (){
77
+ $ html = $ this ->getField ('GetStartedURL ' );
78
+ if (empty ($ html )){
79
+ $ html = "https://identity.linuxfoundation.org/openstack/pid/317 " ;
80
+ }
81
+ return $ html ;
82
+ }
83
+
84
+ public function getAlreadyRegisteredURL (){
85
+ $ html = $ this ->getField ('AlreadyRegisteredURL ' );
86
+ if (empty ($ html )){
87
+ $ html = 'https://identity.linuxfoundation.org/portal/openstack ' ;
88
+ }
89
+ return $ html ;
90
+ }
91
+
92
+ public function getHeroImageUrl (){
93
+ $ default_url = '/themes/openstack/images/coa/coa-bkgd2.jpg ' ;
94
+ if ($ this ->HeroImage ()->exists ()){
95
+ return $ this ->HeroImage ()->Link ();
96
+ }
97
+ return $ default_url ;
98
+ }
99
+
75
100
function getCMSFields ()
76
101
{
77
102
$ fields = parent ::getCMSFields ();
@@ -80,9 +105,18 @@ function getCMSFields()
80
105
$ fields ->addFieldToTab ('Root.Main ' , new HtmlEditorField ('BannerText ' , 'Banner Text ' ));
81
106
$ fields ->addFieldToTab ('Root.Main ' , new HtmlEditorField ('ExamDetails ' , 'Exam Details ' ));
82
107
$ fields ->addFieldToTab ('Root.Main ' , new TextField ('HandBookLink ' , 'HandBook Link ' ));
108
+ $ fields ->addFieldToTab ('Root.Main ' , new TextField ('GetStartedURL ' , 'Get Started URL ' ));
109
+ $ fields ->addFieldToTab ('Root.Main ' , new TextField ('AlreadyRegisteredURL ' , 'Already Registered URL ' ));
83
110
84
111
if ($ this ->ID > 0 ) {
85
112
113
+ $ logo_field = new UploadField ('HeroImage ' , 'Hero Image ' );
114
+ $ logo_field ->setAllowedMaxFileNumber (1 );
115
+ $ logo_field ->setAllowedFileCategories ('image ' );
116
+ $ logo_field ->setFolderName ('coa/hero_images/ ' );
117
+ $ logo_field ->getValidator ()->setAllowedMaxFileSize (1048576 );
118
+ $ fields ->addFieldToTab ('Root.Main ' , $ logo_field );
119
+
86
120
$ config = GridFieldConfig_RelationEditor::create ();
87
121
88
122
$ config ->removeComponentsByType ('GridFieldEditButton ' );
@@ -135,14 +169,14 @@ public function index(){
135
169
136
170
public function getStarted (){
137
171
if (Member::currentUser ()){
138
- $ this ->redirect (GET_STARTED_URL );
172
+ $ this ->redirect ($ this -> GetStartedURL );
139
173
}
140
174
OpenStackIdCommon::doLogin ($ this ->Link ('get-started ' ));
141
175
}
142
176
143
177
public function alreadyRegistered (){
144
178
if (Member::currentUser ()){
145
- $ this ->redirect (ALREADY_REGISTERED_URL );
179
+ $ this ->redirect ($ this -> AlreadyRegisteredURL );
146
180
}
147
181
OpenStackIdCommon::doLogin ($ this ->Link ('already-registered ' ));
148
182
}
0 commit comments