Jump to content

MarkE

Members
  • Posts

    1,036
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by MarkE

  1. About 8 secs for me with cache cleared. That's with about 50mbps download
  2. 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 ?
  3. 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?
  4. Megastar! My module was going to be a process module a la SettingsFactory, but that does the job perfectly and saved me a task. Ta muchly!
  5. 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?
  6. 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
  7. 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.
  8. 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....
  9. 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.
  10. Alternatively do both and use @Robin S’s ConnectPageFields module. Then you can access the link in either direction without a foreach loop.
  11. I'm using it in a couple of places on one site, but I guess I could revise to the usual FEE.
  12. 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.
  13. 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.
  14. No unwanted side effects so far
  15. I'm wondering if this is a bug. To test it simply put the following into the Tracy console (replacing 114 with the id of a template in your database): $q = $templates->getLoadQuery("id=114"); d($q); d($q->getQuery()); This generates the SQL query: 'SELECT templates.id,templates.name,templates.fieldgroups_id,templates.flags,templates.cache_time,templates.data FROM `templates` WHERE id=:s0X ORDER BY templates.name ' instead of WHERE id=114 Interestingly, the method WireSaveableItems::getLoadQuerySelectors() includes the following comment: // Note: ProcessWire core does not appear to ever reach this point as the // core does not use selectors to load any of its WireSaveableItems which makes me wonder how well tested the use of selectors in this context is...
  16. I am writing a method that extends WireSaveableItems (via a hook) to get a fresh item from the database. What I have so far is this: public function getFreshSaveableItem($event) { $saveables = $event->object; /* @var $saveables WireSaveableItems */ $item = $event->arguments(0); $database = $this->wire()->database; $sql = $saveables->getLoadQuery()->getQuery(); $query = $database->prepare($sql); $query->execute(); $rows = $query->fetchAll(\PDO::FETCH_ASSOC); $freshItem = null; if($item) { $items = new WireArray(); foreach ($rows as $key => $val) { if ($val['id'] == $item->id) { $row = $rows[$key]; $freshItem = $saveables->initItem($row, $items); } } } $saveableItems = array(); foreach($items as $saveable) { $saveableItems = $saveableItems + $saveable->getArray(); } $freshItem->setArray($saveableItems); $event->return = $freshItem; } This works, except that where there are multiple matching rows (e.g. for fieldgroups), they are returned in the wrong order. This is because the rows include other fieldgroups and the sort order is 'sort' which will have duplicates because of the multiple fieldgroups. To eliminate this problem, I wanted to put the selector inside the query - so that, if the item id is 168, it adds 'WHERE id=168' to the query. I implemented this by replacing $sql = $saveables->getLoadQuery()->getQuery(); with $selector = "id=" . $item->id; $sql = $saveables->getLoadQuery($selector)->getQuery(); Unfortunately, these seems to generate the query 'WHERE id=:s0X' and I get a PDO exception SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':s0X ORDER BY sort' I'm afraid my PDO/SQL skills are a bit limited, so I'm not quite sure what is causing this or how to fix it. I'm hoping someone with some higher-order PDO skills can help! If it's any use, I did a bd() for the generated query and attach the Debug info and Full object images below.
  17. This raises a question that I hadn't previously considered: LazyCron is triggered by a guest action. In my use case, some resulting edits should be shown as edits (i.e. not 'quiet'), but showing the user as 'guest' is a bit misleading. So I put the following in my LazyCron hook: /************ * Batch run ************ */ /** * Batch run hooked by LazyCron: ..... */ function batchRun(HookEvent $e) { $batchRunUser = (wire()->users->find("name=batchRun")->first()) ?: wire()->users->add('batchRun'); wire()->users->setCurrentUser($batchRunUser); ..... This seems to do the trick. Is this practice OK, or might there be unwanted side-effects?
  18. Running ProcessChangelog shows that it is connected with PageHitCounter, but is from a LazyCron hook I created which updates related fields, without specifying 'quiet' ?
  19. Maybe that was a slightly ambiguous wording, for brevity's sake. The detailed description is that some of the pages are events which are now in the past. These are no longer accessible via any links on the website, but the page url still works, which made me think that it might be some kind of web crawler accessing them.
  20. I seem to have a few pages which show they have been modified recently by 'guest'. However, they appear to be unchanged and the related templates have set guest access to view only. I thought it might be something to do with page hit counters, but that seems not to be the cause. Some of the pages are only archives and are not directly accessible from the website (i.e. can't be retrieved by following links from the home page), so it seems a bit like a bot, but surely it should not mark the pages as modified? Any ideas?
  21. Did you try snippets in Windows? No need to save, it is automatically put in the screenshots folder which you keep open, so just snapshot it, edit as required and drag. When done, delete all the contents of your folder. Ok so that’s one more step than ideal, but at no development effort!
  22. Not exactly sure what you want @bernhard, but if you are on a Windows machine, just use the snipping tool, select 'open screenshots folder' from the dropdown and drag to the field.
  23. Thanks @bernhard I use RockFrontend and am fairly happy with that approach, although I would prefer to say which template to add, for example, favicon to (e.g. my settings template). Re the new logo field. Would that be accessible elsewhere in the API? I sometimes use the logo in other places than just the admin masthead.
  24. I mean adding a field to a pre-existing template. My preferred approach is that modules may add templates and fields, but not automatically modify existing ones - that should be left to the webmaster or superuser, whether directly via setup or via module settings. Also, any new templates and fields should have names that are unlikely to conflict, e.g. by using an appropriate prefix.
×
×
  • Create New...