From 213cfb031ed11e9ae0be30deb11ddabd6de911b0 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 9 Jan 2012 11:38:10 +0100 Subject: [PATCH 1/2] MINOR Added routing for AssetAdmin to cms/_config.php (required for GridField?) --- _config.php | 1 + 1 file changed, 1 insertion(+) diff --git a/_config.php b/_config.php index 76782128ce..bab718eadd 100644 --- a/_config.php +++ b/_config.php @@ -9,6 +9,7 @@ '' => 'RootURLController', 'admin/bulkload//$Action/$ID/$OtherID' => 'BulkLoaderAdmin', 'admin/cms//$Action/$ID/$OtherID' => 'CMSMain', + 'admin/asset//$Action/$ID/$OtherID' => 'AssetAdmin', 'dev/buildcache/$Action' => 'RebuildStaticCacheTask', )); From 60129f61daffff94f4d21e29b64dadfb05affb92 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 9 Jan 2012 17:32:27 +0100 Subject: [PATCH 2/2] ENHANCEMENT Added new CMSFileAddController --- _config.php | 3 +- code/controllers/CMSFileAddController.php | 35 ++++++++++++++++++ .../Includes/CMSFileAddController_Content.ss | 37 +++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 code/controllers/CMSFileAddController.php create mode 100644 templates/Includes/CMSFileAddController_Content.ss diff --git a/_config.php b/_config.php index bab718eadd..ddd1629be6 100644 --- a/_config.php +++ b/_config.php @@ -36,4 +36,5 @@ CMSMenu::remove_menu_item('CMSPageSettingsController'); CMSMenu::remove_menu_item('CMSPageHistoryController'); CMSMenu::remove_menu_item('CMSPageReportsController'); -CMSMenu::remove_menu_item('CMSPageAddController'); \ No newline at end of file +CMSMenu::remove_menu_item('CMSPageAddController'); +CMSMenu::remove_menu_item('CMSFileAddController'); \ No newline at end of file diff --git a/code/controllers/CMSFileAddController.php b/code/controllers/CMSFileAddController.php new file mode 100644 index 0000000000..06cc9687c0 --- /dev/null +++ b/code/controllers/CMSFileAddController.php @@ -0,0 +1,35 @@ +getUploadIframe()) + ), + new FieldList( + ) + ); + $form->addExtraClass('cms-content center cms-edit-form ' . $this->BaseCSSClasses()); + $form->setTemplate($this->getTemplatesWithSuffix('_EditForm')); + return $form; + } + + + /** + * Display the upload form. Returns an iframe tag that will show admin/assets/uploadiframe. + */ + function getUploadIframe() { + return << + +HTML; + } + +} \ No newline at end of file diff --git a/templates/Includes/CMSFileAddController_Content.ss b/templates/Includes/CMSFileAddController_Content.ss new file mode 100644 index 0000000000..29a6dbf692 --- /dev/null +++ b/templates/Includes/CMSFileAddController_Content.ss @@ -0,0 +1,37 @@ +<% with EditForm %> +
+ +
+
+

<% _t('CMSAddPageController.Title','Add pages') %>

+
+
+ +
+ + <% if Message %> +

$Message

+ <% else %> + + <% end_if %> + +
+ <% if Legend %>$Legend<% end_if %> + <% control Fields %> + $FieldHolder + <% end_control %> +
+
+ +
+ <% if Actions %> +
+ <% control Actions %> + $Field + <% end_control %> +
+ <% end_if %> +
+ +
+<% end_with %>