Page 1 of 1
Error in tab output if user does not have record edit authority
Posted: 2020-05-03 05:40
by David Soul
1) I have set up 2 tabs on a page
2) all user groups who have edit permission for all records see the tabs as intended (all fields in proper tab)
3) users groups who have edit permission only for their own records
a) see tabs functioning correctly for records in their group only
b) they only see the first tab functioning correctly for records they do not have permission to edit (fields for 2nd tab are shown without tab)
I think the tabs should work regardless of whether the user has edit permission for the record?
this is hook file in question:
// hooks/playerstats-dv.js
// create an instance of AppGiniDetailView class
var dv = new AppGiniDetailView();
// file: hooks/TABLENAME-dv.js
// get an instance of AppGiniDetailView
// var dv = new AppGiniDetailView();
// create tab
var tab = dv.addTab( "profile", "Profile", "cog" );
// add single field:
// tab.add( "field1" );
// add multiple fields (array of fieldnames):
tab.add( ["First", "Last", "Nickname", "Born", "Hometown", "clhof", "cups", "CupChampionships", "Honours", "Stats", "Statistics", "Image", "threads"]);
var tab = dv.addTab( "metadata", "metadata", "cog");
// add single field:
// tab.add( "field1" );
// add multiple fields (array of fieldnames);
tab.add( ["ID", "HonoursFlag", "Initial", "Recent", "Span", "ImgNotes", "Accession", "fonds", "Name" ]);
Re: Error in tab output if user does not have record edit authority
Posted: 2020-05-03 06:23
by jsetzer
Can you please check for errors in console tab of your browser's developer tools.
Fields and tabs should be visible even if user only has readonly permissions.
Re: Error in tab output if user does not have record edit authority
Posted: 2020-05-03 06:58
by David Soul
Error log - appears to fail on "statistics" field which is a txt file upload field/
is this what you need - I'm not experience at this at all! (the field is there but but may be without content):
23:47:04.178 problem with label: AppGiniHelper.min.js:6:58153
23:47:04.179 <unavailable> AppGiniHelper.min.js:6:58216
23:47:04.182 problem with label: AppGiniHelper.min.js:6:58153
23:47:04.182 <unavailable> AppGiniHelper.min.js:6:58216
23:47:04.258 field not found: #Statistics AppGiniHelper.min.js:6:131139
23:47:04.422
TypeError: _0x14194d._getField(...) is null AppGiniHelper.min.js:6:144904
23:47:04.861 Use of Mutation Events is deprecated. Use MutationObserver instead. jquery-1.12.4.min.js:3:9646
23:47:06.717 AppGini.detectContentEditableChanges common.js.php:1872:12
23:47:06.835
Promise rejected after context unloaded: Promised response from onMessage listener went out of scope
6 content_script.js:792
sendRequest moz-extension://3b6f108a-da3f-4008-b583-01ad24f1fdf9/javascripts/content_script.js:792
23:47:06.849 Error: Promised response from onMessage listener went out of scope 2 bg.js:62:26
23:47:08.730 AppGini.detectContentEditableChanges 28 common.js.php:1872:12
23:48:04.943 AppGini.detectContentEditableChanges common.js.php:1872:12
23:48:06.073 This page uses the non standard property “zoomâ€. Consider using calc() in the relevant property values, or using “transform†along with “transform-origin: 0 0â€. popup.html
23:48:06.959 AppGini.detectContentEditableChanges 29 common.js.php:1872:12
23:49:05.230 AppGini.detectContentEditableChanges 23 common.js.php:1872:12
23:49:50.670 This page uses the non standard property “zoomâ€. Consider using calc() in the relevant property values, or using “transform†along with “transform-origin: 0 0â€. popup.html
23:49:51.409 AppGini.detectContentEditableChanges 7 common.js.php:1872:12
23:50:05.473 AppGini.detectContentEditableChanges 30 common.js.php:1872:12
23:51:05.672 AppGini.detectContentEditableChanges 30 common.js.php:1872:12
23:52:05.840 AppGini.detectContentEditableChanges 8 common.js.php:1872:12
Re: Error in tab output if user does not have record edit authority
Posted: 2020-05-03 07:36
by jsetzer
The first 6 messages are related to our agh js library, the rest are errors from other sources.
I have seen that some of your fields are lowercase, other fields have uppercase first character. Are you sure the statistics field is named "Statistics" with upper case "S"?
Off topic: I recommend lower case characters for all (!) tables and all (!) fields. Because keeping one naming convention reduces the probability of mis-typing names in all javascript and also in SQL statements.
Re: Error in tab output if user does not have record edit authority
Posted: 2020-05-03 07:42
by David Soul
Yes, re your recommendations Iread that after downloading your helper. I will adjust My practice going forward attached is screen shot showing Statistics is being loaded after the fail!

- C44E4976-7691-4395-B482-994D10CC537B.jpeg (39.22 KiB) Viewed 8125 times
Re: Error in tab output if user does not have record edit authority
Posted: 2020-05-03 07:55
by David Soul
From AppGini app side

- BB576841-3831-41DA-8062-D5F0E122F3AB.jpeg (22.65 KiB) Viewed 8121 times
Re: Error in tab output if user does not have record edit authority
Posted: 2020-05-03 09:20
by David Soul
I've tried moving the "Statistics" field to the first tab, second tab, and created a third tab just for it - all to no avail.
In each case the load fails when it reaches the filed position in the table, as defined in the apgini app itself, when the user doesn't have permission to edit the table.
In each case when the user does have permission to edit the table the load succeeds and the user can see the tabs with the "Statistics" field place in the appropriate tab.
Thanks for you very quick first response to this - but after 2 am local time its time for me to call it quits at this end.
After some rest I'll re-examine with a fresh set of eyes and perhaps see if I get the same results if I:
a) delete the first record (ID 1) or
b) remove the .js entry to use tabs and try using panels instead. IF i do this is there a way to have the first panel open on launch? Or is that default?
Are there any other things I might try to find a work around?
Re: Error in tab output if user does not have record edit authority
Posted: 2020-05-03 12:55
by jsetzer
I am going to examine file upload fields in readonly mode tomorrow.
Re: Error in tab output if user does not have record edit authority
Posted: 2020-05-03 14:51
by jsetzer
I have set up a new testing project and
I confirm there is an error in the following scenario:
- Media: File upload
AND
- file upload field added to a custom tab
AND
- record ist readonly for the current user
Error messages:
(1) Warning
AppGiniHelper | Field not found: #FIELDNAME
(2) Consequential error
Uncaught TypeError: Cannot read property 'closest' of null
I have seen that there is no file-field in readonly mode. As a consequence, the warning "field not found" is correct. I am going to work on a solution anyway. Stay tuned!
Re: Error in tab output if user does not have record edit authority
Posted: 2020-05-04 15:39
by David Soul
Thanks Jan, fingers crossed that you are able to find a solution.
Re: Error in tab output if user does not have record edit authority
Posted: 2020-05-07 10:29
by jsetzer
@David: I have sent a personal download link to you. Can you please download and check with that new version and give me feedback?!
Thank you!
Jan
Re: Error in tab output if user does not have record edit authority
Posted: 2020-05-14 08:23
by David Soul
Thanks for your quick and effective response to my request for support Jan!
Even when I missed half of the problem definition in my initial post, you got to a fully functioning solution in great time - really impressive given the great spread in timezones between me and thee!
Your product is improving my application in so many different ways, thank-you.
Re: Error in tab output if user does not have record edit authority
Posted: 2020-12-18 14:25
by jsetzer
Thanks for your very nice feedback, David! Take care!