Hello everybody,
At the moment the site I'm working on has a basic "About us" page that is simply a Page. I want to create a special type for it, called ApieMusPuslapis ("About Us Page"), because the page has links to some documents related to the firm, and I don't want the admin to have to fiddle with the WYSIWYG editor to link to these documents.
My aim is to introduce a new tab and allow files to be uploaded there. The thing is, with the code below, after a 'dev/build?flush=all', the CMS becomes pretty much unresponsive. Clicking anything such as the button to create a new page, or edit a current one, does nothing. The progress bar with the three dots keeps running for a couple of seconds, and then disappears. The only way to get into a page is to click on the URL in the address bar and hit enter.
Deleting this page type brings all the CMS functionality back, so there has to be a problem with this code.
<?php
class ApieMusPuslapis extends Page {
static $description = 'Informacija apie firmą su specialia dokumentų įkėlimo forma';
static $has_many = array(
'Dokumentas' => 'File'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$docsUpload = new UploadField('Dokumentas');
$fields->addFieldToTab('Root.Dokumentai', $docsUpload);
return $fields;
}
}
class ApieMusPuslapis_Controller extends Page_Controller {
}
Moreover, with Firefox the upload field is pretty much unresponsive. You click on the button, select a file to upload, and nothing happens. Works in IE, though!
I tried changing the $has_many to $many_many after reading the forums about issues with UploadField, yet that doesn't change anything. There's actually a special "Title page" type that uses $has_many on an UploadField for images, and that works fine.
Has anyone had similar problems?
EDIT: After hours of searching I finally found the culprit! Apparently SS3 does not like you saving these php files as UTF-8. Switching back to ANSI in Notepad++ did the trick. I don't have special Lithuanian symbols right now, but that's a minor problem, really.. (though is there a way around this still?)
I guess it'd be good to leave this thread here in case others run into similar problems!