Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

broken appearance while using getCMSFields_forPopup()


Reply


1015 Views

Avatar
dacar

Community Member, 168 Posts

14 January 2010 at 11:55am

Hi,

i have written a custom class to manage some news. The administration of the dataobjects works fine, but there are some optical limitations in the CMS. I have also tried to use the dataobject manager (successfully). But there were too many limitations in the HTMLTextEditor. Could anybody have a look at the attached image? The screenshot shows the problems in detail. The Screenshot is from IE8. With Firefox (3.x) it is the same problem.

I am still not sure, what is the best way to manage data objects like 'news' in Silverstripe. Is it a good idea to save the complete contentblock of one news as HTMLText into one databasefield?

Or is it a better way to build a relation like: One NEWS has many PARTS and one Part has one IMAGE

News
|_ Part 1 - Image
|_ Part 2
|_ Part 3 - image

Maybe someone will post some ideas, suggestions or examples? Is the an existing 'News'-Module?

Here is my code from News.php:

<?php

class News extends DataObject {
   static $singular_name = 'News';
   static $plural_name = 'News';
      
   static $db = array(
   'Headline' => 'Varchar(255)',
   'Subheadline' => 'Varchar(255)',
   'Copytext' => 'HTMLText',
   'Anzeigen' => 'Boolean'
   );   

   function getCMSFields_forPopup() {
      return new FieldSet(
         new TextField('Headline', 'Headline'),
         new TextField('Subheadline', 'Subheadline'),
         new SimpleHTMLEditorField('Copytext','Bitte Text eingeben', array(
            'css' => 'themes/css/editor.css',
            'insertUnorderedList' => true,
            'copy' => true,
            'justifyCenter' => false
            )
         ),
         new CheckboxField('Anzeigen')
      );
   }
   
   static $searchable_fields = array (
      'Headline',
      'Subheadline'
   );
   
   static $summary_fields = array(
      'Created',
      'Headline',
      'Subheadline'
   );
      
   static $field_labels = array (
   );
   

}

class News_Controller extends DataObject {

}

?>

And here the code from NewsHolder.php:

   class NewsHolder extends Page {
   
   static $singular_name = 'News Ãœbersicht';
   static $plural_name = 'News Ãœbersichten';
   
   static $has_many = array(
      'News' => 'News'
   );
   

}

class NewsHolder_Controller extends Page_Controller {

   function init() {
   parent::init();
   // Javascript und CSS für Mouse-Over-Effekte einlesen:
   }

   
}

Thanks a lot, carsten.

Attached Files