Git Product home page Git Product logo

kickassets's Introduction

kickassets's People

Contributors

christopherdarling avatar dospuntocero avatar jeremywarne avatar jonom avatar lingo avatar micahsheets avatar zauberfisch 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

Watchers

 avatar  avatar

kickassets's Issues

Detach in ModelAdmin

If there is a FileAttachmentField in ModelAdmin the detach method won't work as expected. You will need to click detach & save twice as in "Detach => ID=0 => Save => Image reappears=> Detach => Save => Image detached".

This seems to be only the case in ModelAdmin.

I've traced the problem to FileAttachmentField->setValue().
https://github.com/unclecheese/KickAssets/blob/master/code/FileAttachmentField.php#L35

// if button detach clicked then ID = 0, so this condition fails
if($id = Controller::curr()->getRequest()->requestVar($this->Name()."ID")) {
    $value = $id;
}
// in ModelAdmin: the old DataObject will overwrite the currently detached file
elseif(!$value && $data && $data instanceof DataObject && $data->hasMethod($this->name)) {
    $funcName = $this->name;
    if($obj = $data->$funcName()) {
        if($obj instanceof File) {
            $value = $obj->ID;
        }
    }
}

My fix is to check requestVars with isset():

$requests = Controller::curr()->getRequest()->requestVars();
if( isset($requests[$this->Name()."ID"])) {
    $value = $requests[$this->Name()."ID"];
}
elseif(!$value && $data && $data instanceof DataObject && $data->hasMethod($this->name)) {
    $funcName = $this->name;
    if($obj = $data->$funcName()) {
        if($obj instanceof File) {
            $value = $obj->ID;
        }
    }
}

ALT/title translation

More a feature request than a bug:
For the same image it is not possible the have individual titles (or ALT text) on each page. Especially for translations this would be important (accessibility and SEO).

Edit button broken

A double click on a file slides in the right sidebar to edit a file.
I believe the Edit button should do the same.

I tested on Win7, and from the following browsers only in IE the Edit button worked.
IE 9
IE 8
IE 7
Chrome 13.0.782.220
Firefox 6.0.2
Safari 5.1
Opera 11.51

Uploads folder not visible in kickassets Asset Manager.

The normal behavior of SS is to upload files to assets/Uploads. However kickassets seems to upload directly to assets if a default folder has not been set. And I cannot even see the Uploads folder in the interface. Is this intentional or a bug?

Note: Never mind, I found the new "Look for new files" button and that fixed it all up nice. Thanks.

FileAttachmentField setDefaultFolder always creates new folder

I use setDefaultFolder on two FileAttachmentFields in the same DataObject. I pass the same folder path to each one. I expected that if the folder did not exists the 1st one would create the folder and the second one would use the folder created by the 1st one. However I find that each FileAttachmentField creates a new folder. KickAssetField uses Folder::findormake($folder); Which I have found to be very unsatisfactory in that it often will create duplicates of folders even when they exist already.

I have written my own version of FindOrMake that has a lot more logic and is much more robust. This class does make use of Folder::findormake($folder); but first does a lot more checking for an existing valid folder so it does not fail where the other function does.

Here is my utility class. Maybe it can be incorporated into Kickassets.

Title); else $Title = SiteTree::generateURLSegment($Title); $folderTitle = $Title; if ($AppendID) $folderTitle .= '_ID' . $CallerObject->ID; if (!$RootFolder) $RootFolder = 'assets'; if ($CallerObject->$FolderRef > 0) { $supposedFolder = DataObject::get_by_id("Folder", $CallerObject->$FolderRef); // If the ID exists, find if there is a folder in the database of that ID if ($supposedFolder && file_exists($_SERVER{'DOCUMENT_ROOT'} . "/" . $supposedFolder->Filename)) // Make sure the Folder exists in the file system. { $supposedFolder->Title = $folderTitle; $supposedFolder->setName($folderTitle); // If all is good so far make sure the Folder has the right name. $supposedFolder->write(); } else { // If the ID exists and the database knows about the Folder but for some reason it was deleted from the filesystem, // make a new folder and set the new ID $galleries = Folder::findOrMake($RootFolder); $galleries->Title = $RootFolder; $galleries->write(); $folder = Folder::findOrMake($RootFolder. "/" . $folderTitle); $folder->Title = $folderTitle; $folder->setName($folderTitle); $folder->write(); $CallerObject->$FolderRef = $folder->ID; $CallerObject->write(); } } else if( !$CallerObject->$FolderRef || $CallerObject->$FolderRef == 0) // If there is no folder anywhere then go ahead and make the dang thing. { $galleries = Folder::findOrMake($RootFolder); $galleries->Title = $RootFolder; $galleries->write(); $folder = Folder::findOrMake($RootFolder. "/" . $folderTitle); $folder->Title = $folderTitle; $folder->setName($folderTitle); $folder->write(); $CallerObject->$FolderRef = $folder->ID; $CallerObject->write(); } } ``` } ?>

Is it possible to add drag and drop sortability to MultipleFileAttachmentField?

Uncle Cheese,

Do you have plans to add sortability to this field. I often want to attache a lot of images to an object or page and then need to sort them in the CMS to either select the 1st one as a primary image or to just set the order they display very specifically.

I can see how this might be difficult since I am trying to avoid special data objects to hold my images. But in this case there is a table in the database to manage the relationships so maybe it could just be code added to the onBefore Write of the Page or Object that the images are attached to? I might be able to figure out how to modify the form with jquery sortable and then just write some manual queries to put sort values into a sort column of the relationship table.

folder names not appering in insert image drop down

I have two or three installs now of kickassets(which is great) but:

When adding new folders and naming them the names dont appear in the drop down field for entering(and choosing) images to insert in the WYSYWYG area. The new folders just have a name of "new folder" in that drop down. But in the kick assests pop up and via FTP the folders show theier proper name.

I have already tried:

  1. Dev/build?flush=all
  2. Changing permisssions
  3. Lots of naming renaming

But none of the above solutions help. Any Ideas?

THanks in advance

Opening kick assets from a popup

I'm currently using kick assets on a DataObject related to a page and the field itself works great. However trying to open the kick assets admin from there ends up looking really messy since the original popup window is already pretty small and kick assets admin needs to fit in the popup.

I'm not sure if there's a nice way around this but I just wanted to report it in. Everything else works great in the popup and I'm loving the drag&drop experience.

More Call-time pass-by-reference has been deprecated

Umm I just downloaded the latest version and there's still an ampersand in there. The code looks like this:
if(version_compare(PHP_VERSION, '5.3')) {
$file->updateCMSFields(&$fields);

}
else {
$file->updateCMSFields($fields);
}
I'm running version 5.2.11 but I'm still getting an error related to this.
It's on line 600 in KickAssetAdmin.php.

IE

I have read your comment on leftandmain.com and the prev issue on here about IE, but I still wish to bring up this topic again.

I think drag & drop support for IE is out of question, but with some quick changes we could show the IE users a normal uploadify field or even just a normal html form browse button.

Telling a user he has to use another browser is normally fine to me.
but sometimes you have clients that have no other choice then using IE, in that case you can at least tell them that it works in IE, but works way better in a proper browser.

first thing is that in IE if you open a folder, you get a error.
[Notice] Trying to get property of non-object
Problem is, the url is "admin/files/admin/files/browse/1" and not "admin/files/browse/1" as it should be.
simple fix: kickassets.js, Line 388
replace "window.location.href = $t.data('link');" with "window.location.href = '/'.$t.data('link');"
With that simple fix, a IE user can at least browse the files.

Double files visible

For the "upload some files" field I do the following:

  1. Attach multiple files "From files"
  2. Save page
  3. Attach another file "From files"
    -> Now the previously files appear a second time in the list
  4. Save page
    -> Now the double files are removed from the list

seen on Chrome 13.0.782.220 / OSX Lion

File Renaming does not change Title

I noticed that renaming a file or folder in KickAssetsAdmin changes the Name in the database but not the Title. This is a problem in the CMS when selecting a folder to insert an image from since the TinyMCE dropdown for selecting the image uses Title instead of Name. All the folders I created are listed as New-Folder still. I have fixed this by editing KickAssetAdmin.php.

public function updatefilename(SS_HTTPRequest $r) {
    if($file = DataObject::get_by_id("File", (int) $r->requestVar('fileid'))) {
        $file->setName($r->requestVar('new'));
        $file->Title = $r->requestVar('new'); // This is the new line so that Title gets updated as well.
        $file->write();
        $template = $file instanceof Folder ? "Folder" : "File";
        return $this->customise($this->getFields($file))->renderWith($template);
    }

}

When filtering and then deleting, all files in folder get deleted

If you use the search filter box to filter down the visible files based on filename, select them all and then delete them, all the files in the folder get deleted. This happens consistently in our testing and is too dangerous of a gotcha for general release to the CMS users.

A nice general feature to add would be some sort of spinner, or other notification that a async operation is in progress. Dragging and dropping large files doesn't seem to do anything because there is no acknowledgement that any action is being taken - it might be useful to have some area that shows actions happening in the background.

Thanks,
Steve

weird behavior when attaching files

for some reason the file attachment field is uploading several times the same files. its seems that the drag behavior is triggering several times the upload action.

Warning: Call-time pass-by-reference has been deprecated

My install doesn't seem too happy with $file->updateCMSFields(&$fields);

Warning: Call-time pass-by-reference has been deprecated in /srv/www/htdocs/intranet/kickassets/code/KickAssetAdmin.php on line 567

Seems to popup everywhere

Using MultipleFileAttachmentField does not create needed ManyManySort field in the database

After creating the ManyManySort field manually everything seems to work as should.

[26-Feb-2012 05:37:33] Error at sapphire/core/model/MySQLDatabase.php line 525: Couldn't run query:
INSERT INTO "SomePage_MyFiles" ("SomePageID","FileID" , "ManyManySort") VALUES (16, 169 , '1')

Unknown column 'ManyManySort' in 'field list' (http://localhost:8888/ss/admin/EditForm)
[26-Feb-2012 05:39:06] Error at sapphire/core/model/MySQLDatabase.php line 525: Couldn't run query:
INSERT INTO "SomePage_MyFiles" ("SomePageID","FileID" , "ManyManySort") VALUES (16, 169 , '1')

Unknown column 'ManyManySort' in 'field list' (http://localhost:8888/ss/admin/EditForm)

Drag & Drop not working (no Livequery)

When you start silverstripe from a page that doesn't have any KickAssets fields included and then go to edit another page that does have a MultipleFileAttachmentField with the ManyManySortable extension enabled I get a javascript error; "Livequery is not a object". This is because the script manymanysortable.js is loading before livequery is loaded.

I'll submit a pull request shortly with a fix.

"Look for new files" missing

in the normal silverstripe Files & Images tab you can find 3 buttons, "Create", "Delete" and "Look for new files"Look for new files"

"SilverStripe maintains its own database of the files & images stored in your assets/ folder. Click this button to update that database, if files are added to the assets/ folder from outside SilverStripe, for example, if you have uploaded files via FTP."

for users uploading files via ftp this feature is required.

Compatibility between the kickasset file attachement field and UserDefinedForm

Hi,

If we have a file attachement field with a userdefinedform (eg. if you have added a FileAttachmentField to your Page.php..) the UserDefinedForm javascript is broken : can't open field options, can' add any new fields, etc.

Seems the problem is in the javascript for the dragndrop in the file_attachement_field.js file. it works If I remove the

    $('.file_drop').livequery(dnd.ready());

Deleting of files just results in a white window...

Latest master branch version. Steps to reproduce:

In the CMS, klick "Browse files...", choose any file and click "Delete".

The following error shows up in the JS console:

apprise is not defined (kickassets.js, line 413)

When closing the "Browse files" dialog, FileAttachmentField shows "File doesn't exist"

Steps to reproduce the bug:

  • Use a FileAttachmentField in the CMS (to attach an image to a page)
  • Click on "Browse files" to replace the current file with a new one
  • Close the file browse window (using the close button on the top right)
  • The FileAttachmentField will now show the text "File doesn't exist". The page in the CMS has to be refreshed to go back to the "normal" state.

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.