From 60129f61daffff94f4d21e29b64dadfb05affb92 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 9 Jan 2012 17:32:27 +0100 Subject: [PATCH] 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 bab718ea..ddd1629b 100644 --- a/_config.php +++ b/_config.php @@ -36,4 +36,5 @@ CMSMenu::remove_menu_item('CMSPageEditController'); 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 00000000..06cc9687 --- /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 00000000..29a6dbf6 --- /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 %>