Jump to content

MarkE

Members
  • Posts

    921
  • Joined

  • Last visited

  • Days Won

    10

Posts posted by MarkE

  1. 11 hours ago, d'Hinnisdaël said:

    Keep us posted about new releases

    Will do. Please note that the code on GitHub may be behind the latest version and may well contain bugs. I will post on the Forum when I am happy with it.

    4 hours ago, da² said:

    most of the time I'll just add and configure new/existing fields and templates, and it looks like it can be done with "fields" and "templates" database tables

    I haven't tried this. It might work if you have not changed any pages at all. I would be afraid of breaking relationships and, personally, I sometimes use pages to hold settings that are not user-updatable and which I might need to migrate, so that would not be a solution for me.

    4 hours ago, da² said:

    you don't need to take care of future PW features or changes to add them in your JSON exporter/importer

    Fair point. Particularly re any special field types introduced in modules. ProcessDbMigrate does cater for most of them (I am just updating it for FieldtypePageTable) including some which store attributes as objects, but would need updating if there are major changes or additions to the core (my guess, though, is that these are very unlikely to be breaking changes).

    1 hour ago, Rasso said:

    Have you thought about reaching out to @ryan about possibly merging your module into core and/or work on the functionality together?

    It is clear to me from previous discusssions that @ryanis not convinced of the need for this in the core and, indeed, does not feel the need for it personally. I consider that a shame as the lack of this functionality is in my view the only major missing feature in ProcessWire. The topic has been debated here numerous times with no clear conclusion. As a consequence, those of us who feel the need have had to turn to modules - either our own or others'. RockMigrations has been released for a while and is well-supported. Both that and ProcessDbMigrate are open-source so, unless @ryanchanges his mind, it will be up to the community to contribute to module development or, indeed, take it over should the original author no longer maintain it. That will depend on how important the community thinks it is.

    1 hour ago, Rasso said:

    This definitely sounds like something I'd reach out to Ryan about.

    I think I reported some issues without any action being taken. Also, I recall that the export functions were left as work in progress some time ago. But I may mis-remember...

    • Like 4
  2. 9 hours ago, d'Hinnisdaël said:

    However, it being JSON-based should be a good enough base to start automating some of this, e.g. by saving and reading the JSON from disk.

    I have a json based migrations module that I released some time ago (ProcessDbMigrate). It needed further work, so I have not publicised it further after the initial proof of concept. In the meantime I have improved it enormously and tested it quite extensively with multiple field types including RepeaterMatrix. It is almost ready for re-release. It is a completely different concept to RockMigrations, which is an excellent and well-established module. My module will automatically track database changes as you make them in the back end UI and then export json for installation in the target. It also provides for roll-back, database comparisons and much more. Hopefully out before Christmas. 
     

    PS I found during the course of development that there are quite a few flaws in the native export functions and had to re-write quite a bit. 

    • Like 8
  3. 19 hours ago, bernhard said:

    I'd also need a field like this for events, eg MyEvent 1.12.2023 19:00 - 2.12.2023 03:00

    Actually, I realised that even for the cottage booking system, although the booking form is only dates, not times, I use date and time in the back end because the time is the access/leave time (see below) - the default times are auto-filled from settings  

    IMG_0325.thumb.jpeg.308b96856974778e34b000b067ad0220.jpeg

     

    • Like 1
  4. 3 hours ago, Kiwi Chris said:

    I've wanted to have locked pages, but allow users to duplicate them?

    I’ve had the same need and dealt with it via such that when a “locked” page is edited, it gives an option to create a new one like this. In my implementation it is all dealt with in a process module, rather than in the page list. I can supply more details if you want. 

  5. Hi @joe_g. How about 3 templates: person, role and article.

    Role has 3 fields: title (name of the role) and page ref fields to each of person and article

    Person and article have page ref fields to role.

    Use ConnectPageFields module - 2 entries for each of the 2 relationships.

    Allow new pages to be created when in the page ref fields of person and article templates.

    You can then add a new role page when editing person or article, complete with the required linkage.

    Use API to get all the role/article combinations for any person etc.

    If you want to restrict roles to a list then you could use a select options or even another page ref field, and just put a ref in the title.

     

  6. This does the business nicely, but I wonder whether the 'Modules' menu item could be optional or modifiable. I want to include the module config links on a webmaster's dashboard - which I can do easily (and include a &collapse_info=1 param, which I think makes sense in this context), but then I don't really need/want the 'Modules' menu item.

    Edit: Maybe something like a config field "Menu name" with "Modules" as the default. Blanking it would remove the menu, or a different name could be used.

    Edit2: And maybe an option to collapse the info section 😉

    • Like 1
  7. I'm planning to upgrade one of my PW apps to include a better set of pagebuilding tools (easy to use but powerful!) - at present it just uses the standard PW CMS so there is not much scope for users to customise their site. A while back (for another site) I wrote my own pagebuilder which relied heavily on RepeaterMatrix, Latte, CSS grids and RockFrontEnd. It works well but is more complex than I would like. I know there has been quite a bit of discussion about this topic in the past (and in particular I think @Jonathan Lahijani wrote this), but things have moved on a bit, with @jploch's PageGrid and @bernhard's (waiting, waiting...) RockPageBuilder. Also, I would like to make some custom widgets available in my page builder and the new component module by @ukyo looks interesting.

    Does anyone have any experiences and insights they would like to share?

  8. Should getModuleConfigInputfields() be declared in a module as static or not? Also, I am confused that som modules use an array as the parameter whereas others use an InputfieldWrapper.

    For example, WireMailSmtp has 

    static public function getModuleConfigInputfields(array $data)

    whereas WireMailRouter has

    public function getModuleConfigInputfields(InputfieldWrapper $inputfields)

    I am trying to build a module that allows certain configs to be set outside the modules themselves (to allow non-superuser access), so I need to call the getModuleConfigInputfields() method, but without knowing what parameter to supply. If it is an array, I can use getConfig(), but otherwise what. And why do different modules do it differently anyway?

  9. 8 hours ago, MarkE said:

    However, with ProcessEmailToPage for some reason, not all the fields got populated

    OK, the problem here seems to be that values of fieldset children are omitted by ProcessSettingsFactory. Somewhere between (in the buildForm() method) line 136 $form->add($fArray); and line 174 return $form; the values of the fieldset children get dropped. If I comment out the section

    foreach($inputfields as $key => $cField) {
    ...
    }

    the field values load correctly

  10. 14 hours ago, Macrura said:

    One way is to create a json file with the fields you want to give access to from the other module

    Thaks @Macrura - Yeah - I thought about that, but reckoned that just calling the other module's getModuleConfigInputfields was easier. However, with ProcessEmailToPage for some reason, not all the fields got populated. Here is my code (in templates/process-email-to-page.php)

    $wire->addHookBefore('ProcessSettingsFactory::execute', function(HookEvent $event) {
    	$object = $event->object;
    	if($object->input->post('submit_save')) {
    		$settingsKey = $object->wire('page')->name;
    		$form = $object->buildForm();
    		$form->processInput($object->input->post);
    		$myData = $form->children[0]->children->explode(['name', 'value']);
    		$newData = [];
    		foreach($myData as $item) {
    			$newData[$item['name']] = $item['value'];
    		}
    		// Here I will call $modules->saveConfig('ProcessEmailToPage', $newData) once the debugging shows I have the full data
    		bd(['form' => $form, 'myData' => $myData, 'newData' => $newData], 'In execute hook - save'); // newData is not complete
    	}
    });
    
    $data = $modules->getConfig('ProcessEmailToPage');
    $fields = ProcessEmailToPage::getModuleConfigInputfields($data);
    return $fields;

    The other modules I want to set similarly are WireMailMailgun, WireMailRouter and WireMailSmtp.

  11. On 6/26/2021 at 10:20 PM, Macrura said:

    Settings Factory was created precisely for this use case

    Hi @Macrura. Maybe I'm being dim, but how do you use settings factory to maintain the config of another module? I know you can edit the module config 'raw/JSON' directly in the module settings (if you are superuser), but I don't see how to do it from settings factory as there doesn't seem to be a real json file.

    I would like to have someone with 'settings-factory' permission to update the configs of certain modules (as per the OP, but not necessarily my own modules, so I can't hack their code).

    EDIT:

    Some progress by using a php file with (for example)

    $data = $modules->getConfig('ProcessEmailToPage');
    return ProcessEmailToPage::getModuleConfigInputfields($data);

    That displays the config. Just need to work out how to update it - I guess a hook....

  12. Is intended that the tooltips only work with checkboxes, not asmselect or select multiple? Otherwise is there something I need to get it working?

    It's a nice addition for checkboxes, but for asmselect it seems I have to stick with custom label formats.

  13. On 9/9/2023 at 9:31 AM, bernhard said:

    So if you have many documents but just a few users add the page field to documents. If you have many users but just a few documents add the page field to the user template and add read documents to the field.

    Alternatively do both and use @Robin S’s ConnectPageFields module. Then you can access the link in either direction without a foreach loop. 

  14. 47 minutes ago, JayGee said:

    Purely out of curiosity can I ask the nature of your project you need this for? We’ve done a few app projects where we’ve considered separation of concerns over multiple PW instances but have never ultimately thought it would be beneficial versus just running 1 site. 

    I have also done an multi-instance app. The context is a holiday cottage booking system where the admin system is one site and the public website is separate. The connection is for the availability and prices. There can be more than one public website, for multiple properties. That way, the (fairly simple) public site does not get entangled in the rather more complex admin app. If there was a simple way of segregating different categories of templates, fields and pages in the back-end then maybe it would not be necessary (I.e. different “views” of the database), but even so I think a physical separation is best. 

    • Like 1
  15. I have had this problem sometimes on a windows machine. It seems to happen for no apparent reason and then go away again. I know that’s not very helpful. Intermittent bugs are the hardest to track down. However, it is helpful to know you are not alone! Next time it happens, I’ll pay more attention to what might have caused it. 

    • Like 1
×
×
  • Create New...