Robin S 7,314 Posted November 12, 2016 LimitPageTable A module for ProcessWire CMS/CMF. Allows limits and restrictions to be placed on selected PageTable fields. Usage Install the LimitPageTable module. For the PageTable field you want to limit, on the "Input" tab include "template" or "template.label" in "Table fields to display in admin". You can skip this step if your PageTable field only allows a single template. In the module config, fill out the fields in the fieldset row: PageTable field you want to limit Role that restrictions will apply to Template you want to limit (only needed if your PageTable field allows more than one template) Field you have included in the "Table fields to display in admin" setting (only needed if your PageTable field allows more than one template) Limit Option to prevent drag sorting of items (affects all rows regardless of template) Option to prevent trashing of items (affects all rows regardless of template) Option to disable all "Add" buttons for any template You can add rows as needed using the "Add another row" button. If you are using translated text for the default PageTable "Add New" button then enter the translation in "Text for default 'Add New' button". Please note that limits and restrictions are applied with CSS/JS so should not be considered tamper-proof. http://modules.processwire.com/modules/limit-page-table/https://github.com/Toutouwai/LimitPageTable Module config: Demo showing PageTable limited to 2 pages using 'Blank' template: 13 Share this post Link to post Share on other sites
alexcapes 55 Posted November 12, 2016 Wonderful, thank you @Robin S - installed on 3.0.39 and all seems to be working perfectly. This kind of extra control over PageTable fields is something I find more need of the more I use this type of field. 3 Share this post Link to post Share on other sites
alexcapes 55 Posted November 14, 2016 @Robin S I think I've found an issue with the module. It seems to stop image fields from working correctly. When I upload images now I get a thumb + spinner but the spinner never stops. This is what I see in the inspector: Uncaught SyntaxError: Unexpected token < in JSON at position 0(…) parseJSON @ JqueryCore.js?v=1479135253:2 (anonymous function) @ InputfieldImage.min.js?v=119-1479135253:1 When I uninstall the module, image fields work as expected again. 1 Share this post Link to post Share on other sites
Robin S 7,314 Posted November 15, 2016 12 hours ago, alexcapes said: It seems to stop image fields from working correctly. Thanks for the bug report. If you grab the latest version from GitHub the issue should be fixed. 2 Share this post Link to post Share on other sites
alexcapes 55 Posted November 15, 2016 6 hours ago, Robin S said: Thanks for the bug report. If you grab the latest version from GitHub the issue should be fixed. Thanks @Robin S - fixes the issue for me. 1 Share this post Link to post Share on other sites
Robin S 7,314 Posted November 23, 2016 v0.0.6 released. PageTables may now be restricted by role (uses CSS/JS so not suitable for mission-critical restrictions) New options to prevent trash, prevent drag sorting, and removal of all "Add" buttons regardless of template. Improved config system (screenshot in first post updated) 1 Share this post Link to post Share on other sites
szabesz 2,837 Posted November 23, 2016 Thanx a lot! I wish it was part of the core... 1 Share this post Link to post Share on other sites
NikNak 17 Posted December 14, 2016 Hi Robin Thanks for your hard work on this. One thing I noticed was that if you do not restrict the actions to a role, then none of the restrictions are applied at all. For example, I want to hide the trash buttons for everyone, including superusers, but by not selecting a restriction by role, none of the modifications are made for anyone, and all the buttons and functionality is in place as if you weren't using the module. Kind regards Nik Share this post Link to post Share on other sites
Robin S 7,314 Posted December 14, 2016 5 hours ago, NikNak said: One thing I noticed was that if you do not restrict the actions to a role, then none of the restrictions are applied at all. Hi NikNak. That's correct - think of the role dropdown as a required field. Come to think of it, I will set the that config inputfield as required in a module update. 5 hours ago, NikNak said: For example, I want to hide the trash buttons for everyone, including superusers, but by not selecting a restriction by role, none of the modifications are made for anyone, and all the buttons and functionality is in place as if you weren't using the module. While it would be possible to restrict PageTables for superusers with this module, I deliberately excluded superusers from the role dropdown. My view is that it is part of the PW philosophy that the superuser role is not subject to any access restrictions and I want the module to be consistent with that. IMHO the only user that should have the superuser role is the site developer - you shouldn't give superuser access to a client. Better to create new role for the client with whatever access is needed. 1 Share this post Link to post Share on other sites
NikNak 17 Posted December 15, 2016 Thanks Robin. Understood about superuser, and agreed - never let a client have superuser access. Kind regards Nik 1 Share this post Link to post Share on other sites
Robin S 7,314 Posted February 4, 2017 v0.0.9 released. You can now select multiple roles to be affected by the limit/restrictions, including the superuser role and "all roles". @NikNak, I had a change of thinking on this issue and can now see that there are situations when it is useful for the module to affect superusers, mostly to serve as a reminder and prevent accidental changes. In any case a superuser can access the module config and so change any restrictions that are affecting them when needed. 5 Share this post Link to post Share on other sites
Macrura 3,077 Posted February 4, 2017 not sure if this could be handled by the module, and haven't researched yet about this... but i wonder about the possibility of hide and unpublish buttons on a page table, because it is something that would save my users a lot of time; example would be we have homepage sections which are handled by a page table. there can be many sections to the page table, but sometimes a user might want to hide one and unhide another one; in the current functionality of PT afaik you need to open the item, go to the settings page and check the buttons... TIA for reading! 1 Share this post Link to post Share on other sites
Robin S 7,314 Posted February 4, 2017 41 minutes ago, Macrura said: but i wonder about the possibility of hide and unpublish buttons on a page table, because it is something that would save my users a lot of time Sounds like a useful thing to have. In terms of UI I imagine something like the action buttons in Page List, where publish/unpublish/hide/unhide buttons appear when hovering the title link in the table. Will investigate how this could be added. Not sure if it's something that belongs in LimitPageTable, or should be a separate module, or perhaps added to AdminOnSteroids. Will have a think. 3 Share this post Link to post Share on other sites
tpr 3,235 Posted February 4, 2017 Here's my idea on how a repeater field could be limited. Instead of a hard lmit there could be a "separator", eg. consider a scenario of limit 3: Item above limit Item above limit Item above limit ------ separator ----- Item below limit Item below limit Item below limit ... As you can see there is no real limit but only a visual separator. Moving item 6 to the top would push all other items one place down, but still only the first 3 would be above the limit. The advantage would be that you shouldn't need to delete an item and can reuse them later. Anyway, I'm fine with the current solution, just wanted to share 2 Share this post Link to post Share on other sites
Macrura 3,077 Posted February 4, 2017 57 minutes ago, Robin S said: Sounds like a useful thing to have. In terms of UI I imagine something like the action buttons in Page List, where publish/unpublish/hide/unhide buttons appear when hovering the title link in the table. Will investigate how this could be added. Not sure if it's something that belongs in LimitPageTable, or should be a separate module, or perhaps added to AdminOnSteroids. Will have a think. cool, thanks! Share this post Link to post Share on other sites
Robin S 7,314 Posted February 8, 2017 On 5/02/2017 at 10:31 AM, Macrura said: but i wonder about the possibility of hide and unpublish buttons on a page table, because it is something that would save my users a lot of time @Macrura, I have released a new module PageTable Extra Actions that provides this feature. 2 Share this post Link to post Share on other sites
Macrura 3,077 Posted February 8, 2017 Thanks, this is all working really well. 2 Share this post Link to post Share on other sites
tpr 3,235 Posted February 8, 2017 Have to find a project where I can use PageTables 1 Share this post Link to post Share on other sites