From b0a5768bb029307083a8a8271c317875c9b950c5 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 3 May 2010 20:43:40 +0000 Subject: [PATCH] FEATURE Added dev/regress admin UI --- _config.php | 4 ++ code/FrameworktestRegressSessionAdmin.php | 88 +++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 code/FrameworktestRegressSessionAdmin.php diff --git a/_config.php b/_config.php index 9a46730..c388cdf 100644 --- a/_config.php +++ b/_config.php @@ -6,4 +6,8 @@ Object::add_extension('Member', 'FileUploadRole'); Object::add_extension('SiteConfig', 'CMSWorkflowSiteConfigDecorator'); CMSWorkflowSiteConfigDecorator::apply_active_config(); + +Director::addRules(100, array( + 'dev/regress/$Action/$ID' => 'FrameworktestRegressSessionAdmin' +)); ?> \ No newline at end of file diff --git a/code/FrameworktestRegressSessionAdmin.php b/code/FrameworktestRegressSessionAdmin.php new file mode 100644 index 0000000..890e990 --- /dev/null +++ b/code/FrameworktestRegressSessionAdmin.php @@ -0,0 +1,88 @@ +Use this form to set configuration prior to starting a regress.silverstripe.com test session (manual testing).

' + ), + $dbField = new DropdownField( + 'db', + 'Database', + array( + 'mysql' => 'MySQL', + 'postgresql' => 'Postgres', + 'mssql' => 'MSSQL', + 'sqlite3' => 'SQLite3', + ), + Session::get('db') + ), + $chkField = new CheckboxField( + 'enabletranslatable', + 'Translatable?', + Session::get('enabletranslatable') + ) + ), + $actions + ); + $dbField->setHasEmptyDefault(false); + + if($isRunning) { + foreach($form->Fields() as $field) { + $form->Fields()->replaceField($field->Name(), + $field->performReadonlyTransformation() + ); + } + } + + return $form; + } + + function startsession($data, $form) { + Session::set('enabletranslatable', (isset($data['enabletranslatable'])) ? $data['enabletranslatable'] : null); + Session::set('db', $data['db']); + + return $this->redirect('dev/build/?BackURL=admin'); + } + + function endsession() { + Session::set('enabletranslatable', null); + Session::set('db', null); + + return $this->redirectBack(); + } + +} \ No newline at end of file