21302 Posts in 5736 Topics by 2603 members
| Go to End | Next > | |
| Author | Topic: | 1539 Views |
-
Extending the Admin CMS - Dealers Tab

4 May 2010 at 12:15am Last edited: 4 May 2010 11:23pm
Hello,
I want to extend the Admin part of the CMS because I want to create a dealer Locator.
I've made a sketch on how it must look:
Specs:
- Extra tab in CMS: Dealers (list must contain all the dealers in the dataBase)
- With the icons you must be able to delete or modify an entry
- With the add button you must be able to add an entry- Variables in each row/entry:
naam varchar(100)
adres varchar(100)
postcode varchar(6)
plaats varchar(100)
telefoon varchar(25)
website varchar(150)Tutorial
I already followed some tutorials about this subject, but they are not sufficient. When I tried the tutorials I got a white screen..
followed:
- http://doc.silverstripe.org/modeladmin?s[]=modeladmin
and:
- http://doc.silverstripe.org/dataobject#customizing_scaffolded_fieldsAlso done read this presentation:
- http://www.slideshare.net/chillu/modeladmin-in-silverstripe-23
and downloaded the files, see page 28, and click the link.But those files didnt work for me with SilverStripe 2.3.7!
Combined the files with my files online, but when: dev/build?flush=1
I only go a white screen..!) Please help me, where do I start to build this feature?
Thank you!
-
Re: Extending the Admin CMS - Dealers Tab

5 May 2010 at 2:14am
In a hurry?
This should get you going: it will create a Dealer Locator menu item in the CMS, where you can add Dealers using the ModelAdmin functionality. Just curious - why not just use a ComplexTableField (or DataObjectManager if you wish) on some Dealer Page (unless you're planning to add a large amount of dealers, that is)?Dealer.php
<?php
class Dealer extends DataObject {static $db = array(
'naam' => 'Varchar(100)',
'adres' => 'Varchar(100)',
'postcode' => 'Varchar(6)',
'plaats' => 'Varchar(100)',
'telefoon' => 'Varchar(25)',
'website' => 'Varchar(150)',
);static $searchable_fields = array(
'naam',
'adres',
'postcode',
'plaats'
);static $summary_fields = array(
'naam',
'adres',
'postcode',
'plaats'
);
}
?>DealerAdmin.php
<?php
class DealerAdmin extends ModelAdmin {public static $managed_models = array(
'Dealer'
);static $url_segment = 'dealerlocator';
static $menu_title = 'Dealer Locator';
}
?>
Do a /dev/build/?flush=1 after -
Re: Extending the Admin CMS - Dealers Tab

5 May 2010 at 2:22am
I pressed the button twice
but yes I'm in a hurry
I really like SilverStripe and want to learn as fast a possible ;)
Thank you for the code I will try it in a second! Thank you.
There will be like 400 dealers, therefor a different section would be nice?
I already have a database with 400 dealers in it, so I hope SilverStripe will be able to add 'records/rows' in this structure. -
Re: Extending the Admin CMS - Dealers Tab

5 May 2010 at 2:32am
Ok SUPER it works
How do I add a pencil-icon behind every entry so I can modify it? -
Re: Extending the Admin CMS - Dealers Tab

5 May 2010 at 2:36am
You can't (unless you want to go through a whole lot of trouble) and you don't have to. Just click on the items you added to open the popup...
-
Re: Extending the Admin CMS - Dealers Tab

5 May 2010 at 3:31am
I've magaged to change all my old entry's to the new database format.
So changed the record format from:
INSERT INTO `Dealer` (`ID`, `naam`, `adres`, `postcode`, `plaats`, `telefoon`, `website`)
into:
INSERT INTO `Dealer` (`ID`, `ClassName`, `Created`, `LastEdited`, `naam`, `adres`, `postcode`, `plaats`, `telefoon`, `website`) VALUES
and it works
But I do like to be able to make changes to each record in SilverStripe, now it is not possible. When I click a dealer, I can type new text into a field, but i can't hit the save button.
Is it possible to add this?
| 1539 Views | ||
| Go to Top | Next > |
