Giter Site home page Giter Site logo

colymba / gridfieldbulkeditingtools Goto Github PK

View Code? Open in Web Editor NEW
87.0 16.0 78.0 2.32 MB

SilverStripe GridField Components set for bulk upload and bulk record edit, unlink & delete :package::boom:

License: BSD 3-Clause "New" or "Revised" License

PHP 72.97% JavaScript 22.28% Scheme 0.87% SCSS 3.88%
silverstripe uploader manager bulk-upload gridfield

gridfieldbulkeditingtools's People

Contributors

a2nt avatar axllent avatar bilekt3 avatar christopherdarling avatar cjsewell avatar colymba avatar dependabot[bot] avatar emteknetnz avatar firesphere avatar forsdahl avatar gordonbanderson avatar guysartorelli avatar jonom avatar kinglozzer avatar lekoala avatar marcusdalgren avatar martinduparc avatar mattybalaam avatar mellm0 avatar mlewis-everley avatar nedmas avatar nightjar avatar phillprice avatar purplespider avatar robbieaverill avatar sabina-talipova avatar simonwelsh avatar steffen-maass avatar tractorcow avatar wernerkrauss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gridfieldbulkeditingtools's Issues

Error when using with the last SS development version

here you are the error log when uploading 2 files:

[04-Jul-2013 15:19:07] Error at framework/core/Core.php line 366: singleton() Called without a class (http://sstest.zk/admin/pages/edit/EditForm/field/Gallery/bulkimageupload/upload?locale=it_IT)
[04-Jul-2013 15:19:07] Error at framework/core/Core.php line 368: singleton() passed bad class_name: NULL (http://sstest.zk/admin/pages/edit/EditForm/field/Gallery/bulkimageupload/upload?locale=it_IT)
[04-Jul-2013 15:19:07] Error at framework/control/injector/Injector.php line 847: Uncaught ReflectionException: Class  does not exist (http://sstest.zk/admin/pages/edit/EditForm/field/Gallery/bulkimageupload/upload?locale=it_IT)
[04-Jul-2013 15:19:08] Error at framework/core/Core.php line 366: singleton() Called without a class (http://sstest.zk/admin/pages/edit/EditForm/field/Gallery/bulkimageupload/upload?locale=it_IT)
[04-Jul-2013 15:19:08] Error at framework/core/Core.php line 368: singleton() passed bad class_name: NULL (http://sstest.zk/admin/pages/edit/EditForm/field/Gallery/bulkimageupload/upload?locale=it_IT)
[04-Jul-2013 15:19:08] Error at framework/control/injector/Injector.php line 847: Uncaught ReflectionException: Class  does not exist (http://sstest.zk/admin/pages/edit/EditForm/field/Gallery/bulkimageupload/upload?locale=it_IT)

My code is:

class ZkGallery extends DataExtension {

  public static $has_many = array('Images' => 'ZkGalleryImage');

  public function updateCMSFields(FieldList $fields) {
    parent::updateCMSFields($fields);

        $name = Config::inst()->get('ZkGallery', 'gallery_name');
//      var_dump($name); exit;

    if ($this->owner->ID > 0) {
            $gridFieldConfig = GridFieldConfig_RecordEditor::create();
//          $gridFieldConfig->addComponent(new GridFieldBulkImageUpload());
//          $gridFieldConfig->addComponent(new GFBIUploadField('BulkGallery'));
            $gridFieldConfig->addComponent(new GridFieldBulkImageUpload('Images', array('Title')));
            $gridFieldConfig->addComponent(new GridFieldSortableRows('SortOrder'));

      $gridfield = new GridField("Gallery", $name, $this->owner->Images()->sort("SortOrder"), $gridFieldConfig);

      $fields->addFieldToTab('Root.'.$name, $gridfield);
    }

    return $fields;
  }

  public function ZkGalleryGetImages() {

    return $this->owner->Images()->sort("SortOrder");
  }

}

Public/Private Error

Silverstripe 3.0.5

[Fri Jun 14 16:33:00 2013] [error] [client 81.62.232.166] PHP Fatal error: Access level to GridFieldBulkImageUpload_Request::$url_handlers must be public (as in class RequestHandler) in /var/www/vhosts/probiermau.ch/subdomains/hottrail/GridFieldBulkEditingTools/code/GridFieldBulkImageUpload_Request.php on line 491, referer: http://hottrail.probiermau.ch/admin/pages/edit/EditForm/field/MonkeeBlogEntries/item/7/ItemEditForm/field/GalleryImages/bulkimageupload?flush=1

Limit concurrent uploads & upload order

It would be nice if the bulk upload could be limited to a certain number of concurrent uploads and if the bulk uploading would occur in the correct order (i.e. ordering by filenames).

Background: I'm using it for photo galleries, where it is a problem if a) the browser goes crazy trying to do all at once and b) uploads are placed more or less randomly (i.e. I have to order them all manually afterwards) when uploading, say, a few dozen photos.

Enhancement: Add Finish button.

At the moment after uploading images, although you can navigate back from the 'Back' Button, the only options selectable along the bottom is Cancel and Delete All. Perhaps a 'Finish' button would be a good option to add.

screen shot 2013-06-16 at 19 37 07

Fails if image has_one is in a parent class

  1. Define the image relation on class A
  2. Class B extends class A
  3. Gridfield of class B with standard GridFieldBulkEditingTools configuration (simplest version from documentation, working in other places on the same site)
  4. Upload requests fail with an error at GridFieldBulkImageUpload_Request.php, line 111 ($recordHasOneFields is not an array).

Shouldn't GridFieldBulkImageUpload_Request.php, line 108 read:

$recordHasOneFields = Config::inst()->get($recordClass, 'has_one', Config::INHERITED);

GridFieldBulkUpload attach existing file breaks on folder selection.

Hello,

When I try to bulk upload files from exiting folder I get the popup but once I click on folder dropdown to select files from a different location I receive a 404 error with response:

"I can't handle sub-URLs of a CMSForm object."

Any idea why this is caused? Are you also experiencing this?

Thanks in advance!

dani quilez

BUG Doesn't work with ajax dependent fields

Attempts to add a bulk manager to asset admin using the following code has some issues.

<?php

class AssetAdminExtension extends Extension {

    public function updateEditForm(Form $form) {
        $grid = $form->Fields()->dataFieldByName('File');
        $config = $grid->getConfig();
        $config->addComponent(new GridFieldBulkManager());
    }
}

When editing a file, the "Folder" dropdown doesn't seem to work, with a 404 when attempting to ajax load foldernames. The 404 seems to come from the request to http://ss31test.loc/admin/assets/EditForm/field/File/bulkediting/BulkEditingForm/field/record_15_ParentID/tree

Is this a bug or a limitation of this module?

Javascript errors when moving to production servers

Hi folks,
i got some strange behaviour when using this module (latest version), when deploying it to live servers. Locally eveything works fine. Have you expierienced the same or someone has a clue whats going on. Thanks for help.
Here is theerrors stack trace:

Uncaught exception
TypeError
in onmatch on

​…​
​ jquery.entwine-dist.js:888 Stack Trace: TypeError: Cannot read property 'innerHTML' of null at Function.tmpl.load (eval at (http://domain.com/framework/thirdparty/jquery/jquery.js?m=1400147683:614:22), :34:43) at tmpl (eval at (http://domain.com/framework/thirdparty/jquery/jquery.js?m=1400147683:614:22), :22:27) at $.widget._initTemplates (eval at (http://domain.com/framework/thirdparty/jquery/jquery.js?m=1400147683:614:22), :8:43) at null._initTemplates (http://domain.com/framework/thirdparty/jquery-ui/jquery-ui.js?m=1400147687:431:26) at $.widget._create (eval at (http://domain.com/framework/thirdparty/jquery/jquery.js?m=1400147683:614:22), :517:18) at null. (http://domain.com/framework/thirdparty/jquery-ui/jquery-ui.js?m=1400147687:431:26) at $.widget._create (eval at (http://domain.com/framework/thirdparty/jquery/jquery.js?m=1400147683:614:22), :104:45) at null._create (http://domain.com/framework/thirdparty/jquery-ui/jquery-ui.js?m=1400147687:431:26) at $.Widget._createWidget (http://domain.com/framework/thirdparty/jquery-ui/jquery-ui.js?m=1400147687:596:8) at new $.(anonymous function).(anonymous function) (http://domain.com/framework/thirdparty/jquery-ui/jquery-ui.js?m=1400147687:395:9) jquery.entwine-dist.js:891 Uncaught exception TypeError in onmatch on
​…​
​ jquery.entwine-dist.js:888 Stack Trace: TypeError: Cannot read property 'innerHTML' of null at Function.tmpl.load (eval at (http://domain.com/framework/thirdparty/jquery/jquery.js?m=1400147683:614:22), :34:43) at tmpl (eval at (http://domain.com/framework/thirdparty/jquery/jquery.js?m=1400147683:614:22), :22:27) at $.widget._initTemplates (eval at (http://domain.com/framework/thirdparty/jquery/jquery.js?m=1400147683:614:22), :8:43) at null._initTemplates (http://domain.com/framework/thirdparty/jquery-ui/jquery-ui.js?m=1400147687:431:26) at $.widget._create (eval at (http://domain.com/framework/thirdparty/jquery/jquery.js?m=1400147683:614:22), :517:18) at null. (http://domain.com/framework/thirdparty/jquery-ui/jquery-ui.js?m=1400147687:431:26) at $.widget._create (eval at (http://domain.com/framework/thirdparty/jquery/jquery.js?m=1400147683:614:22), :104:45) at null._create (http://domain.com/framework/thirdparty/jquery-ui/jquery-ui.js?m=1400147687:431:26) at $.Widget._createWidget (http://domain.com/framework/thirdparty/jquery-ui/jquery-ui.js?m=1400147687:596:8) at new $.(anonymous function).(anonymous function) (http://domain.com/framework/thirdparty/jquery-ui/jquery-ui.js?m=1400147687:395:9) jquery.entwine-dist.js:891 Uncaught exception TypeError in onmatch on
​…​
​ jquery.entwine-dist.js:888 Stack Trace: TypeError: Cannot read property 'innerHTML' of null at Function.tmpl.load (eval at (http://domain.com/framework/thirdparty/jquery/jquery.js?m=1400147683:614:22), :34:43) at tmpl (eval at (http://domain.com/framework/thirdparty/jquery/jquery.js?m=1400147683:614:22), :22:27) at $.widget._initTemplates (eval at (http://domain.com/framework/thirdparty/jquery/jquery.js?m=1400147683:614:22), :8:43) at null._initTemplates (http://domain.com/framework/thirdparty/jquery-ui/jquery-ui.js?m=1400147687:431:26) at $.widget._create (eval at (http://domain.com/framework/thirdparty/jquery/jquery.js?m=1400147683:614:22), :517:18) at null. (http://domain.com/framework/thirdparty/jquery-ui/jquery-ui.js?m=1400147687:431:26) at $.widget._create (eval at (http://domain.com/framework/thirdparty/jquery/jquery.js?m=1400147683:614:22), :104:45) at null._create (http://domain.com/framework/thirdparty/jquery-ui/jquery-ui.js?m=1400147687:431:26) at $.Widget._createWidget (http://domain.com/framework/thirdparty/jquery-ui/jquery-ui.js?m=1400147687:596:8) at new $.(anonymous function).(anonymous function) (http://domain.com/framework/thirdparty/jquery-ui/jquery-ui.js?m=1400147687:395:9)

GridFieldBulkUpload doesn't work with IE 8, 9, 10 & 11

It would seem that GridFieldBulkUpload doesn't work with any of the latest 4 IE versions. The file (or files) is added "From your computer", followed by the progress bar of the uploads which progresses all the way across but never completes. The user is also presented with a "Do you want to open or save [random-uploaded-filename] from [servername]?" which I suspect if related directly to the issue. Have tested on IE 8 (XP), 9 (Win 7), 10 (Win 7) and 11 (Win 8).

Only the first of any of the queued files is actually uploaded (seen only when clicking "Finish" button etc).

Tested with latest master as well as v2.0.1, both on SilverStripe 3.1.5 & 3.1.6. Works perfectly in Firefox & Chrome.

Not working on few Server.

Hello There ! First of all Thank you so much for this module.

I am facing one strange issue with this module. Bulk upload is working fine on my local/staging server but when I am trying to use this on Live server it always showing "Please wait ... Upload in progress" (see screenshot). I can guess it may be something about server configurations but don't know what. Tested on Chrome/Firefox and same result. Can you please help me with this. I am sorry If its a wrong place to ask this question but couldn't find any other way and site have to go live today :(

Screenshot from 2013-03-22 11:16:50

Bulk Image Upload: ID not saved to DB

Hi, i am using the latest SS branch (3.1) with translatable and the latest branch from GridFieldBulkEditingTools.

Bulk uploading is working fine. But the image ID's won't be saved to the DB field. The hidden field looks always like

the relations are set correctely. Any suggestions?

page.php:
private static $has_many = array(
'Seitenkopfbilder' => 'Seitenkopfbilder
);

$seitenkopfbildergridFieldConfig = GridFieldConfig_RecordEditor::create();
$seitenkopfbildergridFieldConfig->addComponent(new GridFieldBulkEditingTools());
$seitenkopfbildergridFieldConfig->addComponent(new GridFieldSortableRows('Sort'));
$seitenkopfbildergridFieldConfig->addComponent(new GridFieldBulkImageUpload());

$seitenkopfbildergridfield = new GridField("Seitenkopfbilder", "Seitenkopfbilder für den Content", $this->Seitenkopfbilder()->sort("Sort"), $seitenkopfbildergridFieldConfig);

Seitenkopfbilder.php:

'Varchar(100)', 'Sort' => 'Int' ); ``` static $has_one = array ( 'Seitenkopfbilder' => 'Image', 'Pagelink' => 'SiteTree', 'Page' => 'SiteTree' ); ``` public static $summary_fields = array( 'Thumbnail' => 'Thumbnail' ); static $searchable_fields = array( ); public function getThumbnail() { return $this->Seitenkopfbilder()->CMSThumbnail(); } public function getCMSFields() { ``` $KopfbildField = new UploadField( $name = 'Seitenkopfbilder', $Title = 'Seitenkopfbilder (642 * 335px)' ); $KopfbildField->allowedExtensions = array('jpg', 'png', 'gif'); $KopfbildField->setConfig('allowedMaxFileNumber', 1); $KopfbildField->setFolderName('Seitenkopfbilder'); $KopfbildField->setConfig('previewMaxWidth', 100); $KopfbildField->setConfig('previewMaxHeight', 100); $KopfbildField->setConfig('autoUpload', false); return new FieldList( $KopfbildField, new TextareaField('SEOalttext', 'ALT Text für das Bild. Sollte einen Bezug zum Inhalt der Seite haben.') ); ``` } }

ImageID not being stored?

I have just updated to the latest version using composer, which has also updated CMS/Framework etc.

If I do a bulk upload, the images go into the assets/bulk-upload folder, they are added to Files properly, but on the actual CustomImage class I have made the 'BaseImageID' which is a has_one to Image always comes up as a '0', and on my gridfield the row has no thumbnail.

Any idea why this is happening? If I use the standard add button everything works as expected.

no image id

Instance of String Error

When adding the Bulk editing tools for the comment module requirements the following error is displayed in the admin section:

GridFieldBulkManager::addBulkAction() must be an instance of string, string given, called in /public_html/comments/code/CommentAdmin.php on line 60

A quick fix was to change line 184 in GridFieldBulkManager.php from:

function addBulkAction( string $name, $label = null, $handler = null, $config = null)

to:

function addBulkAction($name, $label = null, $handler = null, $config = null)

It needs further testing but got the modules working together for me...

GridFieldBulkEditingTools does not work anymore on the last development SS 3.1

This errors are fired uploading files:

[30-May-2013 12:34:50] Error at framework/forms/UploadField.php line 511: UploadField->setConfig called with invalid option: 'sequentialUploads' (http://aaa.zk/admin/pages/edit/EditForm/field/GalleryImages/bulkimageupload?flush=all)
[30-May-2013 12:34:50] Error at framework/forms/UploadField.php line 511: UploadField->setConfig called with invalid option: 'url' (http://aaa.zk/admin/pages/edit/EditForm/field/GalleryImages/bulkimageupload?flush=all)

Multiple GridFieldBulkEditingTools on one page

There seems to be a problem with using several GridFieldBulkEditingTools on one page - I can't get bulk editing/delete to work. My guess is that the javascript and PHP code assumes there's only one active instance at one time, since it creates buttons etc with non-unique IDs, which it then uses to hook up events and actions to. The "doBulkActionButton" button is one example. If I create two or more GriedFieldBulkEditingTools on a page, there will be several elements with the same IDs, which the javascript code doesn't seem to take into account. Is there a fix for this?

Add screenshot to README

Looks like a really interesting module, but I suspect that I would get a much better idea of how it works by looking at a screenshot or two :)

'Select all' selects all records even if GridField has reduced set

At example when trying to add the GridFieldBulkManager to Comments:

$commentsConfig = GridFieldConfig::create()->addComponents(
    ...
    new GridFieldBulkEditingTools(),
    new GridFieldBulkManager()
);
$needs = new GridField(
    'Comments', 
    _t('CommentsAdmin.NeedsModeration', 'Needs Moderation'), 
    Comment::get()->where('Moderated = 0'), // only Moderated records!
    $commentsConfig
);

This code will show only 'Moderated=0' records but checking the 'Select all' will mark 'Moderated=1' as well.
Unfortunately I don't have a workaround now.

Error when saving bulk editing

Got an error when saving bulk editing tool:
[18-Jun-2014 12:08:46] Error at framework/model/DataObject.php line 2367: DataObject::setCastedField: Called without a fieldName

The problem seems to come from GridFieldBulkActionEditHandler.php, line 199.
I changed $field->Name = 'record_' . $id . '' . $name;
for $field->Name = 'record
' . $id . '_' . $field->getName();

Seems to work for now, any ideas?

Bulk Edit, cannot update a many_many from belongs_many_many side

I have a GridFieldBulkUploadField with a GridFieldBulkManager that manages uploading pdf files. Each file when uploaded has to be assigned to a particular user. I see the checkboxes for available users but when I click the checkbox it is not saved. I can see in the Firebug console that the data being sent to the server only includes the ID of the File and the Title. The File Object has a $belongs_many_many relationship to the Member subclass that has the $many_many defined on it. Granted I have made my own version of GridFieldBulkUploadField to add 'allowedExtensions' to the config so I can pass it into the UploadField class instance. Is there a callback that I can use to write code to save my custom relation?

API change

I think, for a lot of people, adding the old names, like GridFieldBulkImageUpload() back, would save a lot of people some headaches.

You probably broke a few websites by renaming it, thus a fallback to catch those (optionally, with a warning in dev-mode) could save lives ;)

Reference to Non Existent Method setDownloadTemplateName

I am running with 3.1beta3 and the current master of this module. I have run into a problem where the method setDownloadTemplateName cannot be found. Grepping the entire codebase of SilverStripe including your module, it only appears once

grep -rIn setDownloadTemplateName .
./gridfieldbulkeditingtools/code/GridFieldBulkImageUpload_Request.php:216:      $uploadField->setDownloadTemplateName('colymba-gfbiu-uploadfield-downloadtemplate');        

[BUG] Bulk upload does not work in latest git version

Latest git version does not support "bulk" upload (it is possible upload files only one by one). Problem is hidden in UploadField injection where is not possible control how many files user is able to upload (? missing settings?), when you manually add ->setConfig('allowedMaxFileNumber', 5) (https://github.com/colymba/GridFieldBulkEditingTools/blob/master/bulkUpload/code/GridFieldBulkUpload.php#L162) to function bulkUploadField you are able to upload multiple files.

Template looks OK (there is inherited variable $multiple).

Add allowedExtensions config

Add UploadField's allowedExtensions config as an option.
Or find a way to expose the UploadField's configs...

File edit form only offers $db fields

My getCMSFields() function returns dropdowns for a $has_one relationship and checkboxes for a $many_many, but all I get are the text fields for the $db fields.

Is there a way to get the file edit form to just return the getCMSFields() FieldList?

Bulk Upload button needs UploadField called first?

If I add a GridFieldBulkImageUpload to a gridfield it will often get stuck on the loading stage when I click on the button, or will go to a screen without the drag and drop, see picture:

screen shot 2013-06-17 at 12 02 33

What seems to cure this problem is to either add an UploadField to the same page, or view a different page with an UploadField beforehand during the session.

I am using MAMP, but have also seen this issue on a remote server.

Cannot Save When Using Locales

I installed https://github.com/OpticBlaze/ss3Gallery in order to test the bulk uploading facilities that this module provides. As the website I am doing is in Thai locale, I set it to Thai by default. However saving fails with this error:

ERROR [User Error]: Uncaught InvalidArgumentException: Invalid locale "th_TH?cacheBuster=1358328497853_BIUUF_8"
IN POST /admin/pages/edit/EditForm/field/GalleryImages/bulkimageupload/update?locale=th_TH?cacheBuster=1358328497853_BIUUF_8
Line 319 in /home/gordon/work/git/weboftalent/proudbags/www/translatable/code/model/Translatable.php

The addition of the cachebuster paramater does not take into account the possible existence of a locale parameter

TreeDropdownField/SIteTree doesn't work as an editable field

DataObject

    public function getCMSFields() {
        $thumbField = new UploadField('Image', 'Gallery Image');
        $thumbField->allowedExtensions = array('jpg', 'png', 'gif', 'bmp', 'jpeg');

        return new FieldList(
            new TextField('Caption', 'Caption'),
            new TreeDropdownField('Link', 'Page to link to', 'SiteTree'),
            $thumbField
        );
   }

Gives a JSON error.

Error when using with Translatable

Very nice module!
Though i'm having some trouble when using it together with Translatable.
Downloaded and installed GridFieldBulkEditingTools version from today, just now.

I have translated Pages with untranslated Dataobjects.
In backend when using the bulk editor i get an "Internal Server Error".
Refreshing the page with the generated URL gives this error:
Uncaught InvalidArgumentException: Invalid locale "de_DE/edit?records[]=1".

The generated URL seems looks like this:
http://mydomain.com/admin/pages/edit/EditForm/field/CampaignImages/bulkediting?locale=de_DE/edit?records[]=1&records[]=2&records[]=3

GridFieldBulkEditingTools.php missing

Other modules using previous branches of GridFieldBulkEditingTools reference class GridFieldBulkEditingTools. for example the SS3 gallery module: http://www.silverstriperesources.com/articles/silverstripe-3-gallery-plugin-module/

As this is now missing from the latest branch these other dependant modules no longer function... Is the GridFieldBulkEditingTools.php supposed to be missing and if so should the code include deprecated methods to allow for other older dependant modules...

Please see Silverstripe Forum enquiry: http://www.silverstripe.org/all-other-modules/show/20465?start=56

Problem using bulk image upload on a DataObject with `has_many` Images in ModelAdmin

Hi,

I try to use your module to add attach multiple images to a DataObject and make it managable via ModelAdmin. Here is my summarized model code:

class Client extends DataObject {
  private static $db = array();
  private static $has_many = array(
    "Pictures" => "Image"
  );
  function getCMSFields($params = null) {
    $conf = GridFieldConfig_RelationEditor::create();
    $conf->getComponentByType('GridFieldPaginator')->setItemsPerPage(20);
    $conf->addComponent(new GridFieldBulkImageUpload());
    $gridField = new GridField('Pictures', 'Pictures', $this->SortedPictures(), $conf);
    $dataColumns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
    $dataColumns->setDisplayFields(array(
      'Title' => 'Title',
      'LastEdited' => 'Changed',
      'CMSThumbnail' => 'Preview',
    ));
    $fields->addFieldsToTab('Root.Pictures', array(
      $gridField,
    ));
    return $fields;
  }

  function SortedPictures() {
    return $this->Pictures()->sort("Sort", "ASC");
  }

}

Image is extended with:

class ClientImageExtension extends DataExtension {

  private static $belongs_to = array(
    "Client" => "Client",
  );

  private static $has_one = array(
    "Client" => "Client",
  );

}

The pictures are uploaded correctly to the given folder, but not attached to the record (Client). The upload response is:

ERROR [Notice]: Undefined index: id
IN POST /…/admin/studio/Client/EditForm/field/Client/item/5/ItemEditForm/field/Pictures/bulkimageupload/upload
Line 365 in /…/gridfield-bulk-editing-tools/code/GridFieldBulkImageUpload_Request.php

Source
======
  356:      $uploadField = $this->uploadForm()->Fields()->fieldByName($fileRelationName);
  357:      $uploadField->setRecord($record);
  358:      $uploadResponse = $uploadField->upload( $request );
  359: 
  360:      //get uploaded File response datas
  361:      $uploadResponse = Convert::json2array( $uploadResponse->getBody() );
  362:      $uploadResponse = array_shift( $uploadResponse );
  363:      
  364:      // Attach the file to record.               
* 365:      $record->{"{$fileRelationName}ID"} = $uploadResponse['id'];                 
  366:      $record->write();
  367: 
  368:      // attached record to gridField relation
  369:      $this->gridField->list->add($record->ID);
  370: 
  371:      //get record's CMS Fields

What am I doing wrong? Did I miss to declare a relationship type in one of these models or is there a lack of configuration? Or is it not possible to handle has_many relations with bulk upload (I couldn't find s.th. related in the docs)?

Best regards
Philipp

Bulk Edit: Clicking "Save All" should return to the grid field

When a user has uploaded several images via GridFieldBulkUpload, and then clicked the Edit All button to update a field such as a caption for all the images, upon then clicking the Save All button, it would be nice to return the user back to the gridfield. As the current workflow for this doesn't seem very streamlined.

BulkImage Handler gives errors

In my newsmodule, enabling the Image-editor gives me errors. It breaks when I try
$gridFieldConfig->addComponent(new GridFieldBulkImageUpload());

Giving the error "Error at framework/model/UnsavedRelationList.php line 290: Uncaught LogicException: alterDataQuery can't be called on an UnsavedRelationList. (admin/news/News/EditForm/field/News/item/new)"

Do you have any clue what might cause this? I can occasionally reproduce this, seems to be related to another module (maybe?)

Hide 'Finish' button when uploads still in progress + add activity indicator instead

I've had a few clients click the 'Finish' button before uploading has completed, due to a couple of reasons:

  • There can sometimes be a significant delay between adding photos and their progress bars beginning to move, so some clients think it's waiting for them to click a button to start uploading.
  • If uploading lots of images/files, it can be hard to tell when they have all uploaded. You have to scroll to the bottom of the list to check they are all complete (and then scroll back to the top), or you have to read the text indicating the total number of files and the total uploaded.

To solve these issues, and make it instantly obvious at a glance what's happening, I suggest:

  • Don't display the 'Finish' button until all files have completed uploading, or have thrown an error.
  • While files are still uploading, put an activity indicator such as a 'spinner', in the place of the 'Finish' button to make it clear that things are happening and user input is not yet required.

Images should be added in alphabetical order

When batch uploading several images, they seem to display in alphabetical order while they are uploading, but upon clicking "Finish" they end up being saved in a random order.

Ideally the precise order would be a config option, but alphabetical by name seems good default, and certainly better than the current (random?) order.

Thanks.

Best way for developers to provide their own GridFieldBulkManager actions

Hi,

I'm considering bulk editing for the commenting module and would love to build on top of your work rather than reimplement bulk editing just for comments. The only thing I need to do is provide custom actions to bulkActionName (i.e Mark as Spam, Mark as Moderation) along with the respective backend functionality for those.

Wondering if that is on the cards for the module, can't imagine a 'nice' API for it rather than subclassing request, bulk manager and the JS. GridFieldBulkManager()->addBulkAction($name, $title, function($action) { });

Keen to check on your approach / thoughts.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.