diff --git a/.gitignore b/.gitignore index c91b435..b8346ba 100644 --- a/.gitignore +++ b/.gitignore @@ -34,4 +34,5 @@ .Spotlight-V100 .Trashes ehthumbs.db -Thumbs.db \ No newline at end of file +Thumbs.db +code/.DS_Store diff --git a/_config/config.yml b/_config/config.yml index 8617f11..f525f43 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -1,7 +1,4 @@ --- -ListingsPage: - extensions: - - ExcludeChildren SiteConfig: extensions: - RealEstateSiteConfig @@ -11,20 +8,41 @@ File: - RMSFileExtension Listing: extensions: - - 'Gallery_PageExtension' - - 'CatalogPageExtension' + - Gallery_PageExtension + - CatalogPageExtension parentClass: - - 'ListingsPage' + - ListingsPage + sort_column: false + default_sort: 'Created ASC' + +CommunitiesHolder: + extensions: + - Lumberjack + +MunicipalityPage: + extensions: + - 'Lumberjack' + show_in_sitetree: false + +NeighbourhoodPage: + show_in_sitetree: false ListingUtils: InlcudeMLS: 0 - LeftAndMain: menu_groups: + ListingAdmin: [] Content: - HomePageAdmin - - AboutUsAdmin - - ContactUsAdmin +# - AboutUsAdmin +# - ContactUsAdmin + - ListingsPageAdmin + - CommunitiesAdmin - CMSPagesController - - AssetAdmin \ No newline at end of file + BlogAdmin: [] + NeighbourhoodAdmin: [] + Other: + - ReportAdmin + - AssetAdmin + - TeamAdmin diff --git a/code/ModelAdmin/NeighbourhoodAdmin.php b/code/ModelAdmin/NeighbourhoodAdmin.php index 3af2f81..7b89615 100644 --- a/code/ModelAdmin/NeighbourhoodAdmin.php +++ b/code/ModelAdmin/NeighbourhoodAdmin.php @@ -2,10 +2,10 @@ /** * * @package Realestate Listing System - Neighbourhood Admin - * @requires DataObjectAsPage, Mappable + * @requires Mappable * @author Richard Rudy twitter:@thezenmonkey web: http://designplusawesome.com */ -class NeighbourhoodAdmin extends DataObjectAsPageAdmin { +class NeighbourhoodAdmin extends ModelAdmin { public static $managed_models = array( 'School' diff --git a/code/ModelAdmin/SinglePageAdmins.php b/code/ModelAdmin/SinglePageAdmins.php index 466c920..32ccdeb 100644 --- a/code/ModelAdmin/SinglePageAdmins.php +++ b/code/ModelAdmin/SinglePageAdmins.php @@ -7,6 +7,7 @@ class HomePageAdmin extends SinglePageAdmin { } +/* class ContactUsAdmin extends SinglePageAdmin { private static $menu_title = "Contact"; private static $tree_class = 'Page'; @@ -20,11 +21,25 @@ class AboutUsAdmin extends SinglePageAdmin { private static $url_segment = "about-us"; } +*/ -class ListingsAdmin extends SinglePageAdmin { - private static $menu_title = "Listings"; +class ListingsPageAdmin extends SinglePageAdmin { + private static $menu_title = "Listings Page"; private static $tree_class = 'ListingsPage'; private static $url_segment = "listings-page"; static $menu_icon = 'realestate/images/home.png'; +} + +class CommunitiesAdmin extends SinglePageAdmin { + private static $menu_title = "Communities"; + private static $tree_class = 'CommunitiesHolder'; + private static $url_segment = "communities-page"; + //static $menu_icon = 'realestate/images/home.png'; +} +class BlogAdmin extends SinglePageAdmin { + private static $menu_title = "Blog"; + private static $tree_class = 'Blog'; + private static $url_segment = "blog-admin"; + //static $menu_icon = 'realestate/images/home.png'; } \ No newline at end of file diff --git a/code/Pages/CommunitiesHolder.php b/code/Pages/CommunitiesHolder.php new file mode 100644 index 0000000..35e2d26 --- /dev/null +++ b/code/Pages/CommunitiesHolder.php @@ -0,0 +1,114 @@ +setFrom('Listing'); + $sqlQuery->setWhere('CityID = 0'); + $sqlQuery->selectField('Town'); + $sqlQuery->setDistinct(true); + $result = $sqlQuery->execute(); + + $townList = ''; + + $townDisplay = LiteralField::create('TownList', $townList); + + $fields->addFieldsToTab('Root.ChildPages', array( + HeaderField::create('TownHeader', 'Other Towns Used', 2), + $townDisplay + )); + + //Reorder Main Tab + $mainTab = $fields->fieldByName('Root.Main'); + $fields->removeByName('Main'); + + $fields->findOrMakeTab('Root.Main', $mainTab); + + return $fields; + } + + public function getLumberjackTitle() { + return "Cities"; + } + + /** + * Accessor methods + * ----------------------------------*/ + + + + /** + * Controller actions + * ----------------------------------*/ + + + + /** + * Template accessors + * ----------------------------------*/ + + + + /** + * Object methods + * ----------------------------------*/ + + + + +} + + +class CommunitiesHolder_Controller extends Page_Controller { + + private static $allowed_actions = array ( + ); + + public function init() { + parent::init(); + + } + +} \ No newline at end of file diff --git a/code/Pages/MunicipalityPage.php b/code/Pages/MunicipalityPage.php index b362537..27013e4 100644 --- a/code/Pages/MunicipalityPage.php +++ b/code/Pages/MunicipalityPage.php @@ -11,7 +11,10 @@ class MunicipalityPage extends Community { private static $plural_name = 'Cities'; private static $description = 'Landing Page for Target Market City'; private static $icon = 'realestate/images/communities.png'; - + + private static $allowed_children = array( + 'NeighbourhoodPage' + ); /** * Object vars @@ -46,9 +49,54 @@ class MunicipalityPage extends Community { /** * Common methods * ----------------------------------*/ - - - + + public function getCMSFields() { + $fields = parent::getCMSFIelds(); + + //Create Neighbourhood Gridfield + $pages = SiteTree::get()->filter(array( + 'ParentID' => $this->ID, + 'ClassName' => 'NeighbourhoodPage' + )); + + $gridConfig = GridFieldConfig_Lumberjack::create(); + + $gridConfig->addComponents( + new GridFieldSiteTreeAddNewButton('buttons-before-left') + ); + + $gridField = new GridField( + "Ex", + 'Neighbourhoods', + $pages, + $gridConfig + ); + + + //Create Listing Gridfield + $listings = $this->Listings(); + + $listingConfig = GridFieldConfig_Lumberjack::create(); + + $listingGrid = new GridField( + "Listings", + "Listings", + $listings, + $listingConfig + ); + + $tab = new Tab('NeighbourhoodsTabs', 'Neighbourhoods', $gridField); + $fields->insertAfter($tab, 'Main'); + + $listingTab = new Tab('ListingsTab', 'Listings', $listingGrid); + $fields->insertAfter($listingTab, 'NeighbourhoodsTabs'); + + //$fields->removeFieldFromTab('Root', 'ChildPages'); + + + return $fields; + } + /** * Accessor methods * ----------------------------------*/ diff --git a/code/Pages/NeighbourhoodPage.php b/code/Pages/NeighbourhoodPage.php index df42fa1..a34ca23 100644 --- a/code/Pages/NeighbourhoodPage.php +++ b/code/Pages/NeighbourhoodPage.php @@ -8,6 +8,7 @@ class NeighbourhoodPage extends Community { private static $hide_ancestor = 'Community'; + private static $allowed_children = array(); /** * Object vars