• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

[SOLVED] Lock Row Plugin of F2 missing

Status
Not open for further replies.

bea

Active Member
Hi,
I'm wondering if there is something similar like the Lock Row Plugin of F2.
If someone edit a record, this one is locked for other users.

Many thanks
Bianka
 
I don't remember that either. I remember writing some custom code to do it, but I don't ever recall an official plugin. But I may be wrong.

Either way, no, nothing for 3.x.

-- hugh
 
Hi,
it's a long time ago.... but it still works :)
Attached you will find the list plugin.

Cheers,
Bianka
 
Yes, cheesegrits did several nice custom works and some of them have survived in F3.
 
Ah, OK, yeah, looking at the code, I remember doing that now, and it was indeed after we forked 3.x.

It also uses a 'lockrow' element, which stores the user id and time the row was locked, and renders as a 'locked' / 'unlocked' image in list view (and supports AJAX unlocking in list view).

I scanned through the code, it looks like it wouldn't be too difficult to migrate it to 3.x, but still a fair amount of time consuming work, just because of all the other changes in Fabrik and J!. Probably three hours or so. Let me know if you are interested in funding this.

-- hugh
 
Hi Hugh, that's great and a good feature also for other users.
Let me know about the cost and catch me on skype.
Cheers,
Bianka
 
I committed the new 3.x version of the lockrow element and list plugin to github.

If anyone wants to play around and get back to me with any issues, you should just be able to do a github update, then "Discover", install and enable the two plugins in J!'s extension manager.

The way it works is you add a lockrow element to your form, and the lockrow list plugin to your list. The lockrow element does not show on the form or details view, it has no visible rendering.

When someone edits a row, it gets locked - the lockrow element's field in the table gets set to "timestamp:userid" (like "647362527:954"). That user ID is the "lock owner".

When / if the lock owner saves the form, it gets automatically unlocked. If they don't save it, the lock will time out after the (configurable) TTL (time to live) on the lock element.

While locked, it won't be editable from the list (the edit icon won't be there), and if anyone but the lock owner tries to use a direct component view+form link to it, they'll get a warning, and a details (read only) view.

If you set the lockrow element to be visible in the list, you get padlock icons (locked and unlocked). The lock owner can click on any of "their" locked icons to unlock via AJAX.

I'll probably add another option, to specify an Access Level that can unlock via the list (in addition to the locking user), and (maybe) bypass the locked status for editing.

-- hugh
 
Note to self - add the necessary icon mapping to the BS3 template icon layout. I think Font Awesome uses 'lock-open' rather than 'unlock' for the open padlock.

-- hugh
 
Oh, also note that you'll need to do a full github update, not just grab those two plugins, as there's some changes to the core as well (I added a new FCipher helper, as part of adding non "simple crypt" encryption, which goes away in J! 4.0).

-- hugh
 
Hi Hugh!
I've made a first test and it works!
Just one small issue (in F2 it was the same): When I open a form and go back without submit, the record is locked. The user, who opened the record can unlock it now.

The path to the icon folder is being ignored and instead the font IcoMoon displays a lock icon. I've switch to protostar, but there is no change. The icon is very small and I prefer the fabrik lock icons.
Cheers,
Bianka
 
I didn't test.
But did you try this?
When / if the lock owner saves the form, it gets automatically unlocked. If they don't save it, the lock will time out after the (configurable) TTL (time to live) on the lock element.
 
Hi troester,
I just made a test with TTL (10 Minutes and allow user unlock: no) and the form is still locked. The user who locked the form is the only one who can unlock the record.
Cheers
 
Last edited:
It was locking for hours, not minutes.
With GitHub unlock is working now - but the list is still showing the lock icon...

Edit:
found the 3rd "hour"

Should be ok now.
 
Last edited:
Hi troester,
thanks for the change from hours to minutes. After 10 minutes and refresh the unlock icon and edit icon are shown.
Cheers,
Bianka


I'll probably add another option, to specify an Access Level that can unlock via the list (in addition to the locking user), and (maybe) bypass the locked status for editing.
In F2 I've used update_col plugin to give the administrator the option to reset the lock.
 
Last edited:
Just one small issue (in F2 it was the same): When I open a form and go back without submit, the record is locked. The user, who opened the record can unlock it now.

Yup, that's the only way it can work. Unlocking happens on submit. If they don't submit, we can't unlock it. So all we can do it apply a ttl (time to live) for the lock, and consider it automatically unlocked once that expires. Or you can set a huge ttl, and require manual unlocking. Note that the lock owner should still be able to edit it again, regardless.

The path to the icon folder is being ignored and instead the font IcoMoon displays a lock icon. I've switch to protostar, but there is no change. The icon is very small and I prefer the fabrik lock icons.

Yeah, I rewrote that stuff with icons instead of image files, just because that's the general direction we're heading for everything.

I can do two, and possibly three, things:

First, a quick fix is to increase the font size of the icon. I just committed that:

https://github.com/Fabrik/fabrik/commit/46169e9f04a92ed1d59e56b956128d66199a31f1

Second, I can add settings for the icon names, so you can use whatever icons you like for locked and unlocked. I'm working on that now.

Third ... I might be able to allow you to specify either an icon or an image name, the same way we do in things like the list's detail icons ... if you don't specify a file type ('lock), it's an icon, if you do ('lock.png') we'll try and find a file with that name in the usual icon folder locations, if we find one, we use that, if we don't find one, we strip the file type and assume it's an icon name.

The problem there is that in this case, we have to modify the icon in the Javascript, when unlocking from list view. So (for an icon) we remove the 'locked' icon name class, and add the 'unlocked' icon class. But if it's an img, we have to set the 'path' attribute, rather than removing/adding classes. That's simple enough if we do one or the other, but if it could be either an icon or an img, that gets complicated. Not impossible, just a bit of a pain.

So ... I'll see if you are happy with the larger icon and the ability to specify the icon name. If not, we'll look at the third approach.

-- hugh[/quote]
 
I don't seem to be able to edit that last post to fix the formatting error, so here it is again:


Just one small issue (in F2 it was the same): When I open a form and go back without submit, the record is locked. The user, who opened the record can unlock it now.

Yup, that's the only way it can work. Unlocking happens on submit. If they don't submit, we can't unlock it. So all we can do it apply a ttl (time to live) for the lock, and consider it automatically unlocked once that expires. Or you can set a huge ttl, and require manual unlocking. Note that the lock owner should still be able to edit it again, regardless.

The path to the icon folder is being ignored and instead the font IcoMoon displays a lock icon. I've switch to protostar, but there is no change. The icon is very small and I prefer the fabrik lock icons.

Yeah, I rewrote that stuff with icons instead of image files, just because that's the general direction we're heading for everything.

I can do two, and possibly three, things:

First, a quick fix is to increase the font size of the icon. I just committed that:

https://github.com/Fabrik/fabrik/commit/46169e9f04a92ed1d59e56b956128d66199a31f1

Second, I can add settings for the icon names, so you can use whatever icons you like for locked and unlocked. I'm working on that now.

Third ... I might be able to allow you to specify either an icon or an image name, the same way we do in things like the list's detail icons ... if you don't specify a file type ('lock), it's an icon, if you do ('lock.png') we'll try and find a file with that name in the usual icon folder locations, if we find one, we use that, if we don't find one, we strip the file type and assume it's an icon name.

The problem there is that in this case, we have to modify the icon in the Javascript, when unlocking from list view. So (for an icon) we remove the 'locked' icon name class, and add the 'unlocked' icon class. But if it's an img, we have to set the 'path' attribute, rather than removing/adding classes. That's simple enough if we do one or the other, but if it could be either an icon or an img, that gets complicated. Not impossible, just a bit of a pain.

So ... I'll see if you are happy with the larger icon and the ability to specify the icon name. If not, we'll look at the third approach.

-- hugh
 
Hi Hugh,
many thanks! I've managed to modify the icon with custom code in my template (bigger size and red locked icon).
I'll try to catch you on Skype.

Cheers,
Bianka
 
Hi Hugh,
just noticed, that lockrow plugin disables the function access on my table.
If access nobody and lockrow enabled, the edit button is visible and the table is editable.
Cheers,
Bianka
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top