From 3af703fa9a18a1eebbc95aa869df48ee879d1179 Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Tue, 14 Aug 2012 11:37:32 +1200 Subject: [PATCH] ENHANCEMENT: Add treedropdown to select page when adding a document --- code/cms/DMSDocumentAddExistingField.php | 9 ++++++++- templates/DMSDocumentAddExistingField.ss | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/code/cms/DMSDocumentAddExistingField.php b/code/cms/DMSDocumentAddExistingField.php index c31f601..4146431 100644 --- a/code/cms/DMSDocumentAddExistingField.php +++ b/code/cms/DMSDocumentAddExistingField.php @@ -1,6 +1,13 @@ name = $name; + $this->title = ($title === null) ? $name : $title; + + parent::__construct(new TreeDropdownField('PageSelector', 'Add from another page', 'SiteTree')); + } + /** * Force a record to be used as "Parent" for uploaded Files (eg a Page with a has_one to File) * @param DataObject $record diff --git a/templates/DMSDocumentAddExistingField.ss b/templates/DMSDocumentAddExistingField.ss index 46cb568..04f65dc 100644 --- a/templates/DMSDocumentAddExistingField.ss +++ b/templates/DMSDocumentAddExistingField.ss @@ -9,6 +9,9 @@ + or Add from page + $fieldByName(PageSelector) +