Hi Patrick,
Your code should be:
OCA.Files.FileActions.register(
'file',
'getstate_file',
OC.PERMISSION_UPDATE,
function(){return OC.imagePath('files_w2g','w2g.svg')},
function(filename,context) {
getState(context.dir + '/' + filename,"false");
},t('files_w2g',text)
Assuming that getState() is requiring the full path to the file.
You will need this because FileList.getCurrentDirectory() or
$('#dir').val() is not guaranteed to be the current directory in cases
like the "Shared with you" view.
Cheers,
Vincent
On 06/16/2014 01:31 PM, Hoffmann, Patrick wrote:
> Hello Vincent,
>
> did I interpreted it wrong?
>
> OCA.Files.FileActions.register(
> 'file',
> 'getstate_file',
> OC.PERMISSION_UPDATE,
> function(){return
> OC.imagePath('files_w2g','w2g.svg')},
> function(filename,context){},
> function(filename){
> getState(filename,"false");
> },t('files_w2g',text)
> );
>
> 'text' is a variable.
>
> This code doesn't work. The Filelists won't load. Is my ActionNameID invalid?
>
> Cheers
>
> Patrick
>
> Von: [email protected] [mailto:[email protected]] Im
> Auftrag von Vincent Petry
> Gesendet: Montag, 16. Juni 2014 13:05
> An: List for Developers of ownCloud
> Betreff: Re: [owncloud-devel] OC7 new layout questions
>
> Hello Patrick,
>
> The reason why the old FileActions.register() is limited to "All files" is
> because many older apps cannot deal with more than one file list / container,
> so it is kept as legacy approach.
>
> Also, different file lists have different file actions: for example the
> "Deleted files" only has "Restore" and "Delete".
>
> If you want to make your app work with the other file list views, please use
> OCA.Files.fileActions.register() instead which will register the actions for
> all the other lists (except "Deleted Files").
>
> The action function now has a new "context" argument containing an instance
> of "fileList" (the current FileList instance) and also a "dir" argument that
> tells you in what directory the file is.
> This is because in the "Shared with you" view the viewed files are not all in
> the same directory.
>
> Here is an example handler:
> OCA.Files.fileActions.register(
> 'file',
> 'ActionNameId',
> OC.PERMISSION_UPDATE,
> function() {
> return OC.imagePath('core','actions/someactionicon');
> }, function(filename, context){
> // (...)
> // context.dir contains the file's directory
> // context.fileList contains the instance of FileList that
> called this
> // context.fileActions contains the instance of FileActions
> from which this was called
>
> }, t('yourapp', 'Action Name')
> );
>
> If your app is embedding anything in the $('#filestable') or $('#content')
> container, it might need some extra fixing to make it use the current list's
> container.
>
> Let me know if you need more details.
>
> Cheers,
>
> Vincent
> On 06/16/2014 12:53 PM, Hoffmann, Patrick wrote:
>
>
>
> Gesch?ftsf?hrer: Werner Magin, Winfried Schmuck | HRB 2704 Bad Kreuznach |
> Gesellschafter: Fritz Bittmann Holding GmbH | USt-ID: DE 811 202 181
>
>
> BITO-Lagertechnik
> Bittmann GmbH
> Obertor 29
> D-55590 Meisenheim Telefon:
> Telefax:
> E-Mail:
> Internet: +49 (0) 6753 122 0
> +49 (0) 6753 122 399
> [email protected]
> www.bito.de
>
>
>
> Dieses E-Mail ist nur f?r den Empf?nger bestimmt, an den es gerichtet ist und
> kann vertrauliches bzw. unter das Berufsgeheimnis fallendes Material
> enthalten. Jegliche darin enthaltene Ansicht oder Meinungs?u?erung ist die
> des Autors und stellt nicht notwendigerweise die Ansicht oder Meinung von
> BITO-Lagertechnik Bittmann GmbH dar.
> Sind Sie nicht der Empf?nger und haben diese E-Mail irrt?mlich erhalten, sind
> jegliche Verwendung, Ver?ffentlichung, Weiterleitung, Abschrift oder
> jeglicher Druck dieser E-Mail strengstens untersagt.
> Jede ausgehende E-Mail wird von uns mit h?chster Sorgfalt auf Viren gepr?ft.
> Jedoch ?bernehmen weder BITO-Lagertechnik Bittmann GmbH noch der Absender
> (Patrick Hoffmann) die Haftung f?r Viren; es obliegt Ihrer Verantwortung, die
> E-Mail und deren Anh?nge auf Viren zu pr?fen.
>
> This email is exclusively meant for the addressee and may contain
> confidential information or information which can be classified as
> professional secret. Any view or opinion stated in this email is that of the
> author and does not necessarily represent the view or the opinion of
> BITO-Lagertechnik Bittmann GmbH. If you are not the addressee and if this
> email has been transmitted to you by mistake, you may not make use of,
> publish, transmit, reproduce or print the information contained therein for
> whatever purpose. We take every reasonable care to check all out-bound emails
> for viruses. However, neither BITO-Lagertechnik Bittmann GmbH nor the sender
> (Patrick Hoffmann) can be held liable for the occurrence of viruses and any
> consequential damages. It is therefore the addressee's sole responsibility to
> check incoming emails and attachments for viruses.
>
> Anh?nge - :
> Versand am 16.06.2014 13:31 von Patrick Hoffmann
>
>
>
>
> Hello all,
>
>
>
> today I tried out the new OC7 alpha. but now I have few questions:
>
>
>
>
>
> - I developed the app
> Workin2gether<http://apps.owncloud.com/content/show.php/Workin2gether+%28files_w2g%29?content=164016><http://apps.owncloud.com/content/show.php/Workin2gether+%28files_w2g%29?content=164016>
> but now I have the problem, that
>
>
>
> my app only works in the menu "All files". It doesn't work in Shared with me
> and my shared files.
>
>
>
> The important part is this:
>
>
>
>
>
>
>
> FileActions.register('file',text,OC.PERMISSION_READ,function(){return
> OC.imagePath('files_w2g','w2g.svg')},function(filename){getState(filename,"false");});
>
> Why does this doesn't work for all tabs? Do you have a example,
> how I could add this fileaction better?
>
>
>
>
>
>
>
> - How do you all think about the change from sidebar to the "app
> selection box"?
>
>
>
> In my opinion it's a bit drastical and for my opinion a dislike feature. I
> expected an improvement of the old sidebar, not a new one. Just my thought
>
>
>
> Cheers
>
>
>
> Patrick
>
>
>
>
>
>
>
>
>
> Gesch?ftsf?hrer: Werner Magin, Winfried Schmuck | HRB 2704 Bad Kreuznach |
> Gesellschafter: Fritz Bittmann Holding GmbH | USt-ID: DE 811 202 181
>
>
>
>
>
> BITO-Lagertechnik
>
> Bittmann GmbH
>
> Obertor 29
>
> D-55590 Meisenheim Telefon:
>
> Telefax:
>
> E-Mail:
>
> Internet: +49 (0) 6753 122 0
>
> +49 (0) 6753 122 399
>
> [email protected]<mailto:[email protected]>
>
> www.bito.de<http://www.bito.de>
>
>
>
>
>
>
>
> Dieses E-Mail ist nur f?r den Empf?nger bestimmt, an den es gerichtet ist und
> kann vertrauliches bzw. unter das Berufsgeheimnis fallendes Material
> enthalten. Jegliche darin enthaltene Ansicht oder Meinungs?u?erung ist die
> des Autors und stellt nicht notwendigerweise die Ansicht oder Meinung von
> BITO-Lagertechnik Bittmann GmbH dar.
>
> Sind Sie nicht der Empf?nger und haben diese E-Mail irrt?mlich erhalten, sind
> jegliche Verwendung, Ver?ffentlichung, Weiterleitung, Abschrift oder
> jeglicher Druck dieser E-Mail strengstens untersagt.
>
> Jede ausgehende E-Mail wird von uns mit h?chster Sorgfalt auf Viren gepr?ft.
> Jedoch ?bernehmen weder BITO-Lagertechnik Bittmann GmbH noch der Absender
> (Patrick Hoffmann) die Haftung f?r Viren; es obliegt Ihrer Verantwortung, die
> E-Mail und deren Anh?nge auf Viren zu pr?fen.
>
>
>
> This email is exclusively meant for the addressee and may contain
> confidential information or information which can be classified as
> professional secret. Any view or opinion stated in this email is that of the
> author and does not necessarily represent the view or the opinion of
> BITO-Lagertechnik Bittmann GmbH. If you are not the addressee and if this
> email has been transmitted to you by mistake, you may not make use of,
> publish, transmit, reproduce or print the information contained therein for
> whatever purpose. We take every reasonable care to check all out-bound emails
> for viruses. However, neither BITO-Lagertechnik Bittmann GmbH nor the sender
> (Patrick Hoffmann) can be held liable for the occurrence of viruses and any
> consequential damages. It is therefore the addressee's sole responsibility to
> check incoming emails and attachments for viruses.
>
>
>
> Anh?nge - :
>
> Versand am 16.06.2014 12:53 von Patrick Hoffmann
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
>
> Devel mailing list
>
> [email protected]<mailto:[email protected]>
>
> http://mailman.owncloud.org/mailman/listinfo/devel
>
>
>
>
> _______________________________________________
> Devel mailing list
> [email protected]
> http://mailman.owncloud.org/mailman/listinfo/devel
_______________________________________________
Devel mailing list
[email protected]
http://mailman.owncloud.org/mailman/listinfo/devel