Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Preview: DataObjectManager module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
Go to End
Author Topic: 58297 Views
  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    I've checked in the getUploadFolder() fix. Thanks for that.

    I'm not sure about your second request. Couldn't you just do $manager->setUploadFolder("Uploads/$this->ID")?

  • hu
    Avatar
    Community Member
    21 Posts

    Re: Preview: DataObjectManager module Link to this post

    Or with unique name...

    $managerImages->setUploadFolder('Uploads/[URLSegment]');


    public function __construct($controller, $name, ...)
    {
    ...
       $this->controllerID = $controller->ID;
       $this->controllerURLSegment = $controller->URLSegment;
    }

    public function getUploadFolder()
    {
       $path = $this->uploadFolder;
       $path = str_replace("[ID]", $this->controllerID, $path);
       $path = str_replace("[URLSegment]", $this->controller->URLSegment, $path);
       return $path;
    }

  • hu
    Avatar
    Community Member
    21 Posts

    Re: Preview: DataObjectManager module Link to this post

    @UncleCheese

    you're right. that's what i'm looking for...

    $managerImages->setUploadFolder("Uploads/$this->URLSegment");

    Thank you...

  • drye
    Avatar
    Community Member
    49 Posts

    Re: Preview: DataObjectManager module Link to this post

    @UncleCheese

    What do you think about adding support for a none selection in SimpleTreeDropdownField?

  • Johnny
    Avatar
    Community Member
    34 Posts

    Re: Preview: DataObjectManager module Link to this post

    Hi!

    There's a bug for the swffileupload.

    When :
    Director::set_environment_type ('dev');

    Then the file upload doesn't work. Maybe SS is adding some tags in Ajax responses that swffileupload doesn't know how to handle...

    JP

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    Could you please be more descriptive than "doesn't work?" I have all my FileDataObjectManager instances running in dev mode, so if you could provide details on what is failing and when, I can look into the issue.

  • Johnny
    Avatar
    Community Member
    34 Posts

    Re: Preview: DataObjectManager module Link to this post

    When I try to upload a file, an alert (js) says "An error occurred in the upload. Try again later.". Then, another alert says "There was a problem with the upload.
    The server did not accept it."

    Here's what the debug window says :

    ---SWFUpload Instance Info---
    Version: 2.2.0 Alpha
    Movie Name: SWFUpload_0
    Settings:
       upload_url: http://localhost:8888/parking/FileDataObjectManager_Controller/handleswfupload
       flash_url: http://localhost:8888/parking/swfupload/javascript/swfupload.swf?swfuploadrnd=98096338
       use_query_string: false
       file_post_name: swfupload_file
       post_params: [object Object]
       file_types:
       file_types_description:
       file_size_limit: 32768
       file_upload_limit: 20
       file_queue_limit: 20
       debug: true
       prevent_swf_caching: true
       button_placeholder_id: spanButtonPlaceholder
       button_image_url: http://localhost:8888/parking/swfupload/images/upload_button.png
       button_width: 180
       button_height: 24
       button_text: <span class='button'>Upload files</span>
       button_text_style: .button { font-family: Helvetica, Arial, sans-serif; font-size: 12px; }
       button_text_top_padding: 6
       button_text_left_padding: 6
       button_action: -110
       button_disabled: false
       custom_settings: [object Object]
    Event Handlers:
       swfupload_loaded_handler assigned: true
       file_dialog_start_handler assigned: true
       file_queued_handler assigned: true
       file_queue_error_handler assigned: true
       upload_start_handler assigned: true
       upload_progress_handler assigned: true
       upload_error_handler assigned: true
       upload_success_handler assigned: true
       upload_complete_handler assigned: true
       debug_handler assigned: true

    SWF DEBUG: SWFUpload Init Complete
    SWF DEBUG:
    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:8888/parking/FileDataObjectManager_Controller/handleswfupload
    SWF DEBUG: File Types String: *.*
    SWF DEBUG: Parsed File Types:
    SWF DEBUG: File Types Description: ()
    SWF DEBUG: File Size Limit: 33554432 bytes
    SWF DEBUG: File Upload Limit: 20
    SWF DEBUG: File Queue Limit: 20
    SWF DEBUG: Post Params:
    SWF DEBUG: dataObjectFieldName=Songs
    SWF DEBUG: dataObjectClassName=Song
    SWF DEBUG: fileClassName=File
    SWF DEBUG: controllerID=1
    SWF DEBUG: OverrideUploadFolder=Uploads
    SWF DEBUG: fileFieldName=Attachment
    SWF DEBUG: parentIDName=
    SWF DEBUG: ----- END SWF DEBUG OUTPUT ----
    SWF DEBUG:
    SWF DEBUG: Event: fileDialogStart : Browsing files. Multi Select. Allowed file types: *.*
    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: Event: fileDialogStart : Browsing files. Multi Select. Allowed file types: *.*
    SWF DEBUG: Event: fileDialogComplete: File Dialog window cancelled.
    SWF DEBUG: StartUpload: First file in queue
    SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0
    SWF DEBUG: Global Post Item: dataObjectFieldName=Songs
    SWF DEBUG: Global Post Item: dataObjectClassName=Song
    SWF DEBUG: Global Post Item: fileClassName=File
    SWF DEBUG: Global Post Item: controllerID=1
    SWF DEBUG: Global Post Item: OverrideUploadFolder=Uploads
    SWF DEBUG: Global Post Item: fileFieldName=Attachment
    SWF DEBUG: Global Post Item: parentIDName=
    SWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for upload. Starting upload to http://localhost:8888/parking/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: 4659200. Total: 4951286
    SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 4951286. Total: 4951286
    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: 01 Charley.m4p, File size: 4951286, Message: 500

    It only bugs when the environment is set to dev...

    Hope this could help!

    Thanks!

    JP

  • UncleCheese
    Avatar
    4085 Posts

    Re: Preview: DataObjectManager module Link to this post

    Hi, Johnny,

    Here's what you can do. It's tedious, but it will find the error eventually. Unfortunately, Flash can't report back PHP error output, so all it can tell you is that a 500 error level error occurred.

    To figure out where the error is, first put this in your _config.php:

    SWFUploadConfig::debug();

    Then, go to your handleswfupload() function in FileDataObjectManager_Controller (FileDataObjectManager.php) and put various die() statements in different lines of the code. When you run the uploader, the form will not submit, it will just throw a JS alert that says, "Server said xxx", where "xxx" is the output of your die() statement. Eventually you'll figure out which line is throwing the error. Let me know what it is and I can help you from there.

    58297 Views
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.