Hi I am trying to extend the blog entry and add an image manager... so far I have got this
// in _config
DataObject::add_extension('BlogEntry', 'CustomBlogEntry');
// in CustomBlogEntry.php
<?php
class CustomBlogEntry extends DataObjectDecorator {
function extraStatics() {
static $has_many = array (
'GalleryResources' => 'GalleryResource'
);
}
public function updateCMSFields(FieldSet &$fields) {
$manager = new ImageDataObjectManager(
$this->owner, // Controller
'GalleryResources', // Source name
'GalleryResource', // Source class
'Attachment', // File name on DataObject
array(
'Name' => 'Name',
'Caption' => 'Caption'
//'Category' => 'Category'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
$manager -> setAddTitle("Gallery Image");
$manager->setPluralTitle('Gallery Images');
$manager ->setAllowedFileTypes(array('jpg'));
$manager->setBrowseButtonText("Upload (JPG only)");
$folder = 'BlogEntryGalleries/';
$manager->setUploadFolder($folder);
$fields->addFieldToTab("Root.Content.Gallery Images", $manager);
}
}
// and my GalleryResource class
<?php
class GalleryResource extends DataObject
{
static $db = array (
'Name' => 'Text',
'Caption' => 'Text'
);
static $has_one = array (
'Attachment' => 'File',
'BlogEntry' => 'BlogEntry'
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('Name'),
new TextareaField('Caption'),
new FileIFrameField('Attachment')
);
}
public function Thumbnail()
{
return $this->Attachment()->CroppedImage(125,93);
}
public function Large()
{
if($this->Attachment()->getWidth() > $this->Attachment()->getHeight())
return $this->Attachment()->SetWidth(700);
else
return $this->Attachment()->SetHeight(500);
}
}
This work in that I get the datamanger showing and popup works..
problem is I get an error returned from the swfupload... saying server didnt accept file..
the file is getting uploaded...
My debug from swfupload looks like this
SWF DEBUG: ----- SWF DEBUG OUTPUT ----
SWF DEBUG: Build Number: SWFUPLOAD 2.2.0 Alpha 2008-10-17
SWF DEBUG: movieName: SWFUpload_0
SWF DEBUG: Upload URL: http://localhost/hallertau/www/FileDataObjectManager_Controller/handleswfupload
SWF DEBUG: File Types String: *.jpg;*.JPG;
SWF DEBUG: Parsed File Types: jpg,jpg,
SWF DEBUG: File Types Description: (*.jpg;*.JPG;)
SWF DEBUG: File Size Limit: 52428800 bytes
SWF DEBUG: File Upload Limit: 20
SWF DEBUG: File Queue Limit: 20
SWF DEBUG: Post Params:
SWF DEBUG: dataObjectFieldName=GalleryResources
SWF DEBUG: dataObjectClassName=GalleryResource
SWF DEBUG: parentIDName=BlogEntryID
SWF DEBUG: fileClassName=File
SWF DEBUG: hasDataObject=1
SWF DEBUG: fileFieldName=Attachment
SWF DEBUG: OverrideUploadFolder=BlogEntryGalleries/
SWF DEBUG: controllerID=12
SWF DEBUG: ----- END SWF DEBUG OUTPUT ----
SWF DEBUG:
SWF DEBUG: Event: fileDialogStart : Browsing files. Multi Select. Allowed file types: *.jpg;*.JPG;
SWF DEBUG: Select Handler: Received the files selected from the dialog. Processing the file list...
SWF DEBUG: Event: fileQueued : File ID: SWFUpload_0_0
SWF DEBUG: Event: fileDialogComplete : Finished processing selected files. Files selected: 1. Files Queued: 1
SWF DEBUG: StartUpload: First file in queue
SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0
SWF DEBUG: Global Post Item: dataObjectFieldName=GalleryResources
SWF DEBUG: Global Post Item: dataObjectClassName=GalleryResource
SWF DEBUG: Global Post Item: parentIDName=BlogEntryID
SWF DEBUG: Global Post Item: fileClassName=File
SWF DEBUG: Global Post Item: hasDataObject=1
SWF DEBUG: Global Post Item: fileFieldName=Attachment
SWF DEBUG: Global Post Item: OverrideUploadFolder=BlogEntryGalleries/
SWF DEBUG: Global Post Item: controllerID=12
SWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for upload. Starting upload to http://localhost/hallertau/www/FileDataObjectManager_Controller/handleswfupload for File ID: SWFUpload_0_0
SWF DEBUG: Event: uploadProgress (OPEN): File ID: SWFUpload_0_0
SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 32768. Total: 46958
SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 46958. Total: 46958
SWF DEBUG: Event: uploadError: HTTP ERROR : File ID: SWFUpload_0_0. HTTP Status: 500.
SWF DEBUG: Event: uploadComplete : Upload cycle complete.
Error Code: -200, File name: home_art1.jpg, File size: 46958, Message: 500
Any ideas why it is not accepting even though it is upladed?