Hi Patrick,

You need to use a delegate to catch that file list event higher in the DOM.
There is an example in apps/files_sharing/js/share.js line 74:

            $('#content').delegate('#fileList',
'fileActionsReady',function(ev){
                var fileList = ev.fileList;

then from here you could add:

                var $fileList = fileList.$fileList;
                $fileList.find('tr td.filename a.name span.nametext')
                // etc ...

The delegate construct and the current event system isn't that intuitive.
I will add it to the dev docs as well when I get to it.

Cheers,

Vincent

On 06/17/2014 03:57 PM, Hoffmann, Patrick wrote:
> Hi Vincent,
>
> really useful :)
>
> The last thing what troubles me is how to get the context on the page load....
>
> I use:
>             $('tbody').on('fileActionsReady',function(){
>                                    $('#fileList tr td.filename a.name 
> span.nametext').each(function() {
>                                                var $tr = $(this);
>                                                getState($tr.html(),"true");
>                         });
> });
>
> It updates the status for all files one time on the page load. But I wouldn't 
> get the context variable in this way. For the FileActions it is easy.
> Hm....
>
> Greets
>
> Patrick
> Von: [email protected] [mailto:[email protected]] Im 
> Auftrag von Vincent Petry
> Gesendet: Dienstag, 17. Juni 2014 15:49
> An: List for Developers of ownCloud
> Betreff: Re: [owncloud-devel] WG: OC7a JS context object
>
> Hi Patrick,
>
> I think it should be the original owner, but I'm not 100% sure, sorry.
> You might want to try it out and see for yourself.
>
> This information might be available as well when you get the FileInfo of the 
> file from the PHP side:
>
> $fileInfo = \OC\Files\Filesystem::getFileInfo(pathToFile); // not sure if it 
> should include home dir as well
> $fileInfo['uid_owner'] should contain the owner name.
>
> So basically you wouldn't need the UI to find this out.
>
> There might be even more advanced ways using the sharing API but I don't know 
> how.
>
> Note that you can also get the original file id from 
> context.$file.attr('data-id') which can be used on the PHP side as well.
>
> Cheers,
>
> Vincent
> On 06/17/2014 03:39 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 17.06.2014 15:57 von Patrick Hoffmann
>
>
>
>
> Hello Vincent,
>
>
>
> yeah this will make it easier then I thought.
>
> What contains data-share-owner, the parent sharer or the original owner of 
> the file?
>
>
>
> Cheers,
>
>
>
> Patrick
>
>
>
> Von: [email protected]<mailto:[email protected]> 
> [mailto:[email protected]] Im Auftrag von Vincent Petry
>
> Gesendet: Dienstag, 17. Juni 2014 15:36
>
> An: List for Developers of ownCloud
>
> Betreff: Re: [owncloud-devel] WG: OC7a JS context object
>
>
>
> Hi Patrick,
>
>
>
> I forgot to mention that there is also context.$file that gives you the "tr" 
> of the clicked file.
>
> >From there you could call:
>
>     owner = context.$file.attr('data-share-owner');
>
>
>
> If this value is not defined, it means that you are the owner.
>
> Basically, if the value is defined it means the file was shared with you.
>
>
>
> This value exists for "All files" and "Shared with you".
>
> I hope it is enough for you to resolve them.
>
>
>
> Have you considered using the "fileid" for the locks instead of the full path 
> ?
>
> This would make it safer if files are moved around, assuming that whoever 
> locked the file is allowed to move it to some other place.
>
>
>
> Cheers,
>
>
>
> Vincent
>
> On 06/17/2014 03:15 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]<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 17.06.2014 15:39 von Patrick Hoffmann
>
>
>
>
>
>
>
>
>
> Hello Vincent,
>
>
>
>
>
>
>
> ok with integer makes sense. Strings would be fine too. I just need to 
> determinate from which list the file is.
>
>
>
> context.dir is sadly no option, because it's difficult to say, if it is a 
> shared file or the own one.
>
>
>
>
>
>
>
>
>
>
>
> I create lock handles like this.
>
>
>
>
>
>
>
> 1.    File is your own:
>
>
>
>
>
>
>
> create a lockhandle for your file.
>
>
>
>
>
>
>
>
>
>
>
> 2.    File is shared with you:
>
>
>
>
>
>
>
> Resolve the file in the database until you get to the original source of the 
> file. The path+filename should be now the same as in 1.
>
>
>
> (This is needed when you lock a file and you shared it, all users, who have 
> it shared with, should also see the file locked.
>
>
>
>
>
>
>
> If I use only the path from '/' for example if you have a file text.txt, all 
> users would see their files locked, if the path is the same.
>
>
>
>
>
>
>
> Examples for locknames:
>
>
>
>
>
>
>
> User: Patt
>
>
>
> Datadir = D:
>
>
>
> I share the file text.txt. My lockfile will be named like this:
>
>
>
> D#$Patt$files$text.txt
>
>
>
>
>
>
>
> I share the file with Oliver:
>
>
>
> (In the old version was /Shared used. It was really easy to know, whether the 
> file is a share or a file in your oc profile).
>
>
>
> At default the lockname would be D#$Oliver$files$Shared$text.txt, but my 
> script resolves the share. The name would be
>
>
>
>
>
>
>
> D#$Patt$files$text.txt
>
>
>
>
>
>
>
> Really simple. One lockfile, locked for yourself and for share user. No 
> duplicate bug with same filenames of other users.
>
>
>
> If a third person joins the share too, he would also see the locked file.
>
>
>
> If I would use the context.dir I would have just a relative path. In JS there 
> is no way to get the original user of 'filename' once it is clicked.
>
>
>
>
>
>
>
> Greets
>
>
>
>
>
>
>
> 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]><mailto:[email protected]><mailto:[email protected]>
>
>
>
> www.bito.de<http://www.bito.de><http://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 17.06.2014 15:15 von Patrick Hoffmann
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
>
>
>
> Devel mailing list
>
>
>
> [email protected]<mailto:[email protected]><mailto:[email protected]><mailto:[email protected]>
>
>
>
> http://mailman.owncloud.org/mailman/listinfo/devel
>
>
>
>
>
>
>
>
> _______________________________________________
>
> 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

Reply via email to