Quickstart
Step 1: Download and extract
- After purchase , download the ZIP-file and extract into your project directory.
-
After extract, ensure the following files and folders exist:
1 2 3 4 5 6 7
YOUR_APP_DIRECTORY └ resources └ lib ├ AppGiniHelperRecordLock.php └ AppGiniHelper └ RecordLock └ AppGiniHelperRecordLock.min.js
Optional
1 2 3 4 5 6 |
|
Step 2: Prepare groups, users and permissions
For best testing scenario, create a group having at least two different users.
For testing Record Lock library...
-
Create at least one
Group
for editor users.
( name it according to your needs ) for exampleEditors
-
Grant
Edit own records
onYOUR_TABLE
for groupEditors
-
Create at least two
Members
and assign them toEditors
group
for exampleuser1
anduser2
Note Depending on your AppGini version record locking may not work properly with two different administrator users because in some versions admin users will always have edit permissions and Record Lock library can not revoke edit permissions from admin users. So, I recommend testing it with a separate group and two users of that group.
Step 3: Integrate with your table
-
Open the hooks file
hooks/TABLENAME.php
in your code editor for the table you want to apply Record Locking to, for examplehooks/notes.php
-
Find the
TABLENAME_dv
function, for example
1 2 3 4
// file: hooks/notes.php function notes_dv($selectedID, $memberInfo, &$html, &$args) { }
-
Add the following line to that function and save the file:
1
AppGiniHelperRecordLock::attach("YOUR_TABLE_NAME", $selectedID, $html);
for example
1 2 3 4 5
// file: hooks/notes.php function notes_dv($selectedID, $memberInfo, &$html, &$args) { AppGiniHelperRecordLock::attach("notes", $selectedID, $html); }
Recommendation For demonstration and testing purposes it will be better to check the option
☑ Hide "Save as Copy" when editing records
That checkbox toggles the "Copy" option. If checked, "Copy" option is disabled. If unchecked, "Copy" option is enabled. Checking that option will ensure fields will be readonly when record is locked by a user.
Reason If the "Copy" option is enabled, fields in detail view will still be editable even if someone else has locked that record. With enabled "Copy" option, there is no [Save
]-button but a [Duplicate
]-button. Fields can be edited. That specific record cannot be saved (updated), but a copy can save created(inserted). When testing the Record Lock library it may be irritating to see editable fields. Record still looks like being editable (but isn't). Anyway, Record Locking will work with enabled "Copy" option. It is just it may look irritating.
Test
-
Open a record of your table in Detail View as
user1
or asuser2
and see differences.
> Tip You can simultaneously test with two different users if you open a second browser in incognito mode and login asuser2
. -
Try to lock a record as
user1
and note immediate UI-updates foruser2
. - Try unlocking a locked record and note the UI changes.
Screenshot