Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/20/2021 in all areas

  1. The work on the project got seized so no the need is no longer valid.
    5 points
  2. v1.0.6 improves the groupby() method I have a survey tool where my clients can send emails to all persons participating in that project. Every person can give multiple "feedbacks" to other persons and every "feedback" has several "answers" that can be answered. On the mail-interface they see all persons of the project, but they did not see which of the persons had answered all questions. As they wanted to send a reminder to all that have open questions we needed an aggregated answer-count for each person. I've updated the project from using RockFinder1 to RockFinder3 and so the task got a lot easier ? --- updated readme for groupby() --- If you need the SQL statement instead of a PHP array you can set that as one of several options: $sql = $finder->groupby('foo', [...], ['sql'=>true]); For example you can then JOIN complex queries quite easily: $foo = $rockfinder->find(...); $foosql = $foo->getSQL(); $bar = $rockfinder->find(...); $barsql = $bar->groupby('bar', [...], ['sql'=>true]); $join = "SELECT foo.xx, foo.yy, bar.xx, bar.yy FROM ($foosql) AS foo LEFT JOIN ($barsql) AS bar ON foo.xx = bar.yy"; db($rockfinder->getObjects($sql)); ----- If anybody is interested in the real world code: // setup main finder to find all persons $persons = $rockfinder ->find("template=person, has_parent=$project") ->addColumns(['isFN', 'lang', 'forename', 'surname']); // get results count for all FG (feedback giver) $rf = $rockfinder ->find("template=feedback, has_parent=$project") ->addColumns(['fg', 'answercount']); // add fixed number of questions asked per feedback $questions = $project->competences->count(); $rf->query->select("'$questions' as 'questions'"); // get sql of grouped result (grouping by FG) $answered = $rf->groupby('fg', [ 'IFNULL(sum(questions),0) AS asked', 'IFNULL(sum(answercount),0) AS answered', 'IFNULL(sum(questions),0) - IFNULL(sum(answercount),0) AS todo', ], ['sql' => true]); // build final query $persons = $persons->getSQL(); $sql = "SELECT persons.*, answered.asked, answered.todo FROM ($persons) AS persons LEFT JOIN ($answered) AS answered ON persons.id = answered.fg"; // set sql query as data for RockGrid $grid->setData($sql); Now they can easily sort and filter persons that they want to message ? Happy finding ?
    4 points
  3. https://affinity.serif.com/en-gb/supporting-the-creative-community/ (latest news)
    3 points
  4. It worth to mentions https://htmx.org/ the successor to intercooler.js.
    2 points
  5. @bernhard we use https://pageproofer.com to get feedback and bug reports from clients. It also has video recording option as well.
    2 points
  6. My understanding is that there are three hookable methods that you can use if you want detailed control of which pages are viewable, editable and "listable". Viewable = user may view the page on the front-end. Example hook in /site/init.php: $wire->addHookAfter('Page::viewable', function(HookEvent $event) { $page = $event->object; // Return early if PW has determined that the page is not viewable if(!$event->return) return; // Your test here... if($page->title === 'foo') { // User may not view the page $event->return = false; } }); Editable = user may edit the page in ProcessPageEdit. Example hook in /site/init.php: $wire->addHookAfter('Page::editable', function(HookEvent $event) { $page = $event->object; // Return early if PW has determined that the page is not editable if(!$event->return) return; // Your test here... if($page->title === 'foo') { // User may not edit the page $event->return = false; } }); Listable = user can see the page in ProcessPageList. Note: superusers are not affected. Example hook in /site/init.php: $wire->addHookAfter('Page::listable', function(HookEvent $event) { $page = $event->object; // Return early if PW has determined that the page is not listable if(!$event->return) return; // Your test here... if($page->title === 'foo') { // User may not see the page in ProcessPageList // And therefore may not see its descendant pages either $event->return = false; } }); There's a catch to be aware of with this last hook. Page::listable only affects ProcessPageList and not other parts of the admin. If the existence or title of the page must remain private then you'll need to handle the following separately: Admin search (AJAX results) Admin search (results page if user hits enter) Lister (aka "Find") Maybe other places such as Page Reference fields I think @adrian has some experience with hiding pages from these places and might have some suggestions. Edit: In my opinion it would be nice if PW used Page::listable to automatically restrict the visibility of pages throughout the admin. I opened a request here: https://github.com/processwire/processwire-requests/issues/379 Besides Page::viewable, Page::editable and Page::listable there are also the following hookable methods that can be used in a similar way to the examples shown above. All of these methods are in PagePermissions.module. Page::publishable Page::deleteable (aka Page::deletable) Page::trashable Page::restorable Page::addable Page::moveable Page::sortable
    2 points
  7. If your module has a lot of config fields you might want to divide them into groups inside a tabbed interface. Here is a demonstration module showing how this can be done. https://github.com/Toutouwai/ModuleConfigTabs Thanks to @kixe for providing my starting point in this forum topic.
    1 point
  8. I often need to explain my clients that they need to be more precice with their bug reports and explain step by step what they did and what happened. Today a friend of mine shared a link of an austrian startup that wants to help in such situations with easy on-the-go screen/audio/video recording. https://recorder.calipio.com/home What do you guys think? I could think of a "support" button in the PW backend that opens that tool and sends the link directly to me via mail as a support request...
    1 point
  9. https://www.qubes-os.org
    1 point
  10. Manged to resolve this by deleting the tag field within the database, May have been something to do with a "Image Extra" field.
    1 point
  11. I was also thinking of mentioning it, however, Unipoly seems to implement a lot "more features" and its more advanced, soon to be released new version can be expected in weeks: http://triskweline.de/unpoly2-slides/#1 Note, that while these libraries are similar, but they are far from being the "same". Unipoly is opinionated while HTMX "is not" (at least not that much...), which is a big difference. However, Unipoly offers a lot more out of the box, so I'm myself thinking of using Unipoly v2 in the future. Unipoly v2 also – optionally – supports Bootstrap which is good for even more rapid development. I'm not a big fun of Bootstrap, but Bootstrap 5 and Unipoly 2 looks like a good combo, so I will definitely find some time to test them together in the near future.
    1 point
  12. Thx @adrian I've already done that, but instead of bd($finder->getSQL()); I'd have to use be("<pre>".$finder->getSQL()."</pre>"); now ? See examples: Nicely formatted, but having \n: No \n but a pain to read: Nice format but hard to dump: Maybe I've found a CSS solution: .tracy-dump-string i { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } This prevents all <i> tags in the dump from being copied (at least on my chrome). Should we add that to the tracydebugger style? I've opened an issue at nette: https://github.com/nette/tracy/issues/458
    1 point
  13. Without enabled JavaScript (thus the <noscript> tag), it is not possible to asynchronously load something (as there is no JavaScript to do so – chasing one's own tail).
    1 point
  14. @bernhard - this is something that was added to the Tracy core. Remember that you can use be() - barEcho() - to echo out a string to the dumps panel in the Tracy bar. Does that work OK for you?
    1 point
  15. PagePaths is a core module, you just need to go to Modules > Core and click on "install" ?
    1 point
  16. Thanks for your prompt response. Nothing urgent. Will try and figure it out.
    1 point
  17. I don't really like RockGrid any more, but it was the best option I had back then ? I've had to work on a quite old project over the last few days that uses RockFinder + RockGrid for several data presentation pages. I thought RockFinder3 was way easier to use and much more powerful, so I've added support for RockFinder3 in RockGrid - even it the module will likely not see any updates in the future...
    1 point
  18. @Brian Scramlin, to use WireArray::sort I think the items in the WireArray need to be Wire-derived objects, e.g. WireData. Relevant API documentation: https://processwire.com/api/ref/functions/wire-data/ https://processwire.com/api/ref/functions/wire-array/ Demo:
    1 point
  19. In template files I use the page-id to get the page or, where I have set a specific template name, I use this to get the page, and then uses the $p->url. There are different ways and concepts people uses. I prefer to give own template names to specific pages, limited to one page only, so that I securely can get them from everywhere, regardless what name a editor gives them, or if a site owner deletes a page and creates a new one (what changes the page id). In the templates settings I use the property for mapping a different template (render) file. So, for an unlimited number of basic-pages, 1 imprint page and 1 contact page I use 3 template names and one template file: template file is: site/templates/basic-page.php template names are: basic-page, can be used for (unlimited) new pages imprint, can be used only for one page and is mapped to basic-page (template file) contact, can be used only for one page and is mapped to basic-page (template file) But as already said, that's only my preferred way. ?
    1 point
  20. I think the key issue with admin view access is how the tree handles showing pages/branches below pages that are not viewable. It would break the hierarchy. Admin Restrict Branch is limited in what it does, but I think it does it well. But it's always only going to work with one branch, although for many use cases that is all you need. That said, I'd love to see a core way of hiding pages from view, but again there's that hierarchy problem to solve, or maybe those situations just need to be prevented from happening.
    1 point
  21. My bad, I figured it out. In order to work the class only needs to extend WireData. So the following example works. <?php class MyClass extends WireData { public function ___someFunction() { // Do something } } // ready.php $this->addHookBefore('MyClass::someFunction', function($event) { // some customization });
    1 point
  22. Unfortunately we don't have a view-in-backend permission in ProcessWire. I've hit that wall several times, but it seems that nobody else is seeing that... https://processwire.com/talk/topic/15854-how-to-hide-menu-item-in-the-backend/ https://processwire.com/talk/topic/22369-hide-uneditable-pages-in-admin-treeprocesspagelist/ https://processwire.com/talk/topic/10195-hide-pages-from-admin-tree/ Would be great to open an issue in the requests repo so we could upvote that feature! I think PW would GREATLY benefit of such a permission level. For example @adrian 's "hacky" module should be obsolete then, I guess. Or am I wrong here @adrian?
    1 point
  23. Hi, it sounds like you are correct ? the docs say "Matches whole words only" and these different results between your hosts could come from a "little" less accurate use of full text in the older versions of php and mysql ? have a nice day
    1 point
  24. The title field is already optional. You just need to make it non-global by editing the Title field and unchecking the Global checkbox on the Advanced tab. Then you can remove it from any templates where you don't need it. If you want to see the values of other fields (instead of Title) in Page List you can set that on the Advanced tab when editing the template.
    1 point
  25. I didn't know about adding custom links here, thanks. ? It's somewhat limited though because it can't handle URL segments or GET variables which are widely used in the admin, so you can't link to a module config for instance. My preference would be for a separate panel just for shortcut links, internal and external. The PageListSelect works well for pages but I think inputing URLs would be better because then it's one interface for entering any kind of link. Example: Just thinking out loud here, but when a link is added or changed it would be cool if... The root URL is removed from internal links so link becomes relative. If a URL is submitted without a label... For internal URLs, $pages->getByPath($url) is used, and if a Page object is returned the page title is used as the link label. For external URLs and internal URLs for which getByPath($url) returns a NullPage, attempt to get the title element using DomDocument and use it as the link label. libxml_use_internal_errors(true); $dom = new \DOMDocument(); $dom->loadHTMLFile($url); $list = $dom->getElementsByTagName('title'); $label = $list->length ? $list->item(0)->textContent : $url; These latter features aren't crucial, they're just so we have the option of being lazy and adding a URL only. ?
    1 point
  26. It was fixed after 3.0.165 master was released: https://github.com/processwire/processwire-issues/issues/1247 You can upgrade to the latest dev release to get the fix.
    1 point
  27. Could you please add the steps you are following to reproduce the problem? I'm trying to reproduce it but am not able to. What I'm doing is: Template settings have slashUrls set to false (0). I upload an image to a "single" image field and save the page. I delete the uploaded image file from /site/assets/files/1234/ I check the filesize of the PageImage to confirm that PW can not locate the file. I call the size() method on the PageImage with the now missing file. I tried with both the GD and ImageMagick sizer engines. I check the slashUrls setting of the template. So far I don't experience any changes to the template settings of the page.
    1 point
  28. You could get the field without going via the template fieldgroup, but to get the inputfield and selectable pages I think it's compulsory to supply a Page object. In the case of selectable pages, it's quite common for the selectable pages to change depending on the current page which is perhaps why it's a compulsory argument to getSelectablePages(). I guess you could get the inputfield settings that determine the selectable pages (i.e. parent_id, template_id, findPagesCode, findPagesSelect or findPagesSelector) and then use that to build a $pages->find() selector but that seems like more trouble than supplying a $page argument. For a Page Reference field that isn't in a repeater I think the simplest way is: $options = $page->getInputfield('my_page_ref_field')->getSelectablePages($page); But a Page Reference field inside a repeater is a special case because where the selectable pages depend on the current page, the current page is interpreted as the editable page that contains the repeater, not the repeater page that contains the inputfield. There is discussion about this here: https://github.com/processwire/processwire-issues/issues/479 So you might do something like this: $options = $fields->get('my_page_ref_field')->getInputfield(new Page())->getSelectablePages($page);
    1 point
  29. Just wanted to share the simplest language switcher possible if you only have two languages: <a href="<?= $page->localUrl($languages->findOther()->first()) ?>">DE/EN</a> 😎🤘
    1 point
  30. Hmm, it's installing as expected here. The "requires" setting I've used looks like it conforms to the example given in the Module documentation. Any ideas why it might not be working in your case? I use the "AddNewChildFirst" option in AdminOnSteroids for blog/news items and the dropdowns work well with that. But I get your point and will look at implementing something that honours the "sort settings for children" on the parent page/template. And add a note to the readme about the 25 item limit. Yes, very likely will not be compatible with that module as AdminThemeBoss already modifies the breadcrumbs.
    1 point
×
×
  • Create New...