Jump to content

sgt.blikey

Members
  • Posts

    49
  • Joined

  • Last visited

Everything posted by sgt.blikey

  1. This is a description of a 'members' setup, where a 'member' is a processwire user who is able to manage their own branch of the page tree. Based on a simple site that looks a bit like this. HomeMembersMember APage A1 Page A2 Member B Member CPage C1 Etc. Section XPage X1 Page X2 Section YPage Y1 Members A, B and C can add, edit, sort and delete children of their page Member A/B/C. They may also edit their page Member A/B/C. Without any additional roles they have just ‘view pages’ access elsewhere. Take Section X above as an example, and two roles ‘editor’ and ‘sub-editor’ where the role ‘editor’ can add/edit/delete pages beneath Section X; and the role ‘sub-editor’ can edit pages beneath Section X. Assigning either of these roles to a user who also has the ‘member’ role does not interfere with either scheme. Setup Before adding users I do the following: Enable the permission ‘page-edit-created’ Create a role ‘member’ and grant it ‘page-edit’, ‘page-delete’, ‘page-edit-created’, and ‘page-sort’ permissions Create a template ‘member’ and enable access controls granting role ‘member’ ‘edit pages’ and ‘add children’ in addition to the default ‘view pages’Use the ‘Revoke permissions by role’ function to remove ‘page-delete’ for the role ‘member’ Enable the advanced option ‘Allow the ‘created user’ to be changed on pages’ Create a template ‘members’ and under family settings allow children (specify the ‘member’ template as the allowed template for children/‘members’ template as the allowed parent for template ‘member’); optionally allow only one page using the template ‘members’ Create (or reuse) templates for the children of template ‘member’; specify these as the allowed templates for children of template ‘member’; grant ‘edit pages’ and ‘create pages’ to the role ‘member’ on these templates. Insert the following between lines 638 and 640 in file wire/modules/PagePermissions.module } else if($page->template->name == 'member') { if($user->id == $page->created_users_id) { $addable = true; } Add/Edit a user (e.g. ‘Member A’) and assign role ‘member’ Create a page (e.g. ‘Members’) in the tree with template ‘members’ Add a child page (e.g. ‘Member A’) to the page ‘Members’ On the page ‘Member A’ under Settings, change the ‘Created by User’ to the user ‘Member A’ Repeat for all users assigned the role ‘member’. Er, that’s it. It seems obvious to me that this could be made into a module. I haven't the experience, skills, knowledge required to complete that quickly, but the above works nicely in the way I want it to and this may be of benefit to others here. There may be unintended behaviour that I haven’t located yet. For example (though this is possibly not related to this setup) I’ve seen that when a textarea field has CKeditor as the inputype the ‘member’ users are able to insert images from any page, which is not the desired behaviour. I’ve seen some forum posts that address this, or similar such that I’m confident that this could be overcome. If it were a module, I think this defines what the module does. On install/configure Ask for a plural and singular version of your membership. Check for and enable if necessary the permission ‘page-edit-created’ Check for and create a role ‘singluar’ and enable permissions ‘page-edit’, ‘page-delete’, ‘page-edit-created’, and ‘page-sort’ Check for and create a template ‘plural’ Check for and create a template ‘singular’ and assign ‘edit-pages’ and ‘add pages’ to role ‘singular’‘singular’ template, Allow the ‘created user’ to be changed for pages using this template. Modify the Family rules for the two templates:‘plural’: Can this template be used for new pages?: One (no more allowed) ‘plural’: Allowed template(s) for children: ‘singular’ ‘singular’: Allowed template(s) for parents: ‘plural’ Modify the file wire/modules/PagePermissions.module as per the above In action When a user is assigned the role ‘singular’, (e.g. user ‘Nic’) the following actions are executed. Check for and add a page ‘Nic’ with template ‘singular’ under parent ‘plural’ Change the created user ID for page ‘Nic’ to that of user ‘Nic’. Other ideas Ask at install time where the root page ‘plural’ should be created and create it. What to do when removing the module. Tackle the CKeditor insert image issue EDIT/ADDITION: Either a change to the user template to include a "Full Name" for creating member pages (title field); or less intrusively, add a "Full Name" field to the "member" template and allow the member to enter their own.
  2. E.g. on my imagined home page template there is a page select field that displays a list of all 'image' pages? https://processwire.com/talk/topic/11070-one-image-per-page-making-it-easy-for-editors/ https://processwire.com/talk/topic/11040-visual-page-selector-commercial-page-picker-module-for-processwire/ By the way, it is true that there can be a case where information in addition to 'description' is desired, but it isn't the only case. For example, the members of such a club may not be concerned with anything other than the visual information. In that case an image field is suffiecient. From the point of view of the user that approach is straightforward and other modules can extend it e.g. http://modules.processwire.com/modules/image-extra/
  3. The website of a photography club. Members of the club each have a gallery, a page that consists of a number of fields including an image field. Home page editors would like to select images, which have previously been uploaded by members to their (the member's) galleries, for inclusion on the site's home page. A 'best of' selection if you like.
  4. I deleted and recreated the field and this problem went away.
  5. Apparently not: https://developers.google.com/maps/faq#languagesupport By default the API will attempt to load the most appropriate language based on the users location or browser settings. Cheers, Nic
  6. This seems to also be the case when editing the label field within a table field.
  7. I am having a problem returning values for 'lat' and 'lng', which evaluate to '0.000000' when called in my page's template file. I have a field, 'map', of type MapMarker. The default address is filled out and the corresponding Latitude and Longitude values are populated. The field is included in a template, 'contact-us' and this template is used by a page, 'Contact Us'. In the admin, editing the 'Contact Us' page I see the subfields of my 'map' field are populated correctly and a map is displayed, with a pin dropped in the correct place. I have reduced the contents of contact-us.php to the following: <?php if ($page->map) { echo ("Address: {$page->map->address}<br />"); echo ("Latitude: {$page->map->lat}<br />"); echo ("Longitude: {$page->map->lng}<br />"); echo ("Zoom: {$page->map->zoom}<br />"); } ?> The output is as follows (I have edited the address): Address: Name of Establishment, Street, Town, Postcode Latitude: 0.000000 Longitude: 0.000000 Zoom: 12 I do not understand, why are 'lat' and 'lng' evaluating as '0.000000'? Thanks, Nic Versions: PW = 2.5.29; FieldTypeMapMarker = 2.0.6; InputfieldMapMarker = 2.0.7; MarkupGoogleMap = 1.0.1
  8. Has anyone had difficulty entering or editing image description text while on an iOS device? In my experience today the input box very occasionally accepts a tap to bring up the keyboard and cursor, but mostly behaves as if the field is uneditable. Standard text and textarea fields have been working as expected, as have text and textarea fields within repeaters. It's been a problem on a 2.5.28 and a 2.5.22 site. Nic
  9. @adrian I've had an opportunity to try out the updated module with a repeater containing a table field. It works!
  10. Hi Macrura, Thought I'd let you know that I ran away and hid from this. I restructured the page tree and made some compromises. Doing so released me from having to pursue this, which had me punching way above my weight. Many thanks for your help, Nic
  11. Hi Macrura, That really helped me. There are a couple of problems that I have to solve, which are: When exactly the module is active - it needs to be more specific than if the page template is 'thing' because it executes when the thing is being created, when none of the fields are ready. What to do if $page->cat is null - the subcat page should not be created if no cat is set. I think I'll be back here if I'm unable to figure those problems out. Many thanks for your help, I am now reading http://processwire.com/api/hooks/ Nic
  12. Hi Macrura, Okay, I have successfully created a module that prints the message "Ping!" when the page is saved. Awesome. I feel like I have to describe the whole system in order that I can apply your advice in the correct way, but I don't expect you to have to solve my problem for me, if you see what I mean. The page structure is: 'artworks' (template 'things')'artwork-01' (template 'thing') 'artwork-02' (template 'thing') etc 'categories' (template 'cats')'glass' (template 'cat') 'sculpture' (template 'cat') etc 'techniques' (template 'subcats')fused glass (template 'subcat') cast glass (template 'subcat') ceramic (template 'subcat') etc Template 'thing' has fields 'title', 'cat' and 'subcat' Template 'cat' has field 'title' Template 'subcat' has fields 'title' and 'cat' Field 'cat' is a page field; the parent of selectable pages is 'categories'; the template of selectable pages is 'cat' Field 'subcat' is a page field; the parent of selectable pages is 'techniques'; the template of selectable pages is 'subcat' Both fields have Deference in API as set to 'Single page (Page) or empty page (NullPage) when none selected' (I don't fully understand the significance of the two single page options). Here is will be a screen shot of an artwork page being edited. I have chosen a category for this artwork and want to create a new subcategory 'under' the category that has been selected, in this case 'glass'. (i.e. I can say $pages->find("template=subcat, cat=glass"); to get all the subcategories of the category 'glass'.) Let's say I enter 'sand cast' in the text box for the title of the new subcategory. On Save I want the page 'sand cast' to be created under 'subcategories' and the category 'glass' entered as a value for the field 'category' on that page. That is why I thought I should be looking at the module InputfieldPage.module, because on Save that (I think) is the module that contains the function that adds pages. Many thanks, Nic
  13. Hello Macrura, Thank you for your reply. I think I understand: Create a module, MyModule.module, and place under site/modules/ In the module define its basic information, particularly that it should autoload and be singular. Specify that the actions of the function are carried out when the page is saved. Have the main function check for a particular template and do its thing when the page is saved. If I have that correct I shall have to go away and work through it... Many thanks, Nic
  14. Hello, I have selected to allow new pages to be created from a (page) field, e.g. "sub-category". The template of the pages that would be created contains a field (e.g. "category", also a page field) that is required to have a value. Currently pages are created and the field "cateogry" receives no value. When editing a page that contains this field ("sub-category") and selecting "Create New" I would like to be able to specify a value for the field "category" in addition to being able to specify the title of the page that is created. I think I have to modify/extend the function "processInputAddPages" in the module "InputfieldPage.module" in order to achieve that. Would anyone have any advice regarding this? Many thanks, Nic
  15. @adrian I haven't had an opportunity to use the module within a repeater. I don't think I will do following your guidance. Thanks for your help. Nic
  16. @adrian I (don't) think I had seen the thread you linked to. I guess table fields in repeaters is adding a layer of complexity that need not be there and it would be sensible to follow the PageTables/child pages route. I'll have a go with your updated module and let you know how that goes but will probably implement as PageTables/child pages. Many thanks for acting so promptly. Nic (oops, hadn't actually seen that thread!)
  17. Hi Adrian, This is a jolly helpful module, thanks for developing it. I ran into a problem when using it on a page where the table field is contained within a repeater on the page's template. The set up is as follows: The page template has the following fields: Title Programmes Programmes is a repeater field containing two fields: Year Programme The Year field is an integer field The Programme field is the table field The error occurs on page save and is reported as follows: Notice: Trying to get property of non-object in [my_path_to]/site/modules/TableCsvImportExport/TableCsvImportExport.module on line 263 Warning: Invalid argument supplied for foreach() in [my_path_to]/site/modules/TableCsvImportExport/TableCsvImportExport.module on line 263 Fatal error: Call to a member function makeBlankItem() on a non-object in [my_path_to]/site/modules/TableCsvImportExport/TableCsvImportExport.module on line 277 Error: Call to a member function makeBlankItem() on a non-object (line 277 of [my_path_to]/site/modules/TableCsvImportExport/TableCsvImportExport.module) This error message was shown because site is in debug mode ($config->debug = true; in /site/config.php). Error has been logged. By reworking the template to include only Title and Programme fields (i.e. a single table, no repeater) the problem goes away. I can work with that but wondered, since one of the posts above deals with a similar/related use case, if you can help at all. Many thanks, Nic
  18. Howdy, Without the necessary skills/experience to do this myself I saw that: you can add a field showing the owner of the files (pages) found (actually I was able to do that)sort by that field (that's by default) maybe you can display the files 'owned' by the logged in user (I failed to even try this) I think that would be a useful addition to this module. I appreciate (now, after figuring out how to add an 'owner' field to this module) that 'users' are 'pages' and that there are issues if you assert that an image appearing on a page owned by a user is owned by that user but...
×
×
  • Create New...