Jump to content

Recently Updated Topics

Showing topics posted in for the last 7 days.

This stream auto-updates

  1. Today
  2. https://github.com/clipmagic/ProcessPromptManager @psy Thanx for sharing!
  3. Good morning @da² I have wrapped my head around your problem and I have found a possibility to check file uploads against the value of an input field by using a custom validation. In the following example you have 2 form fields: Field 1 is a text input where you have to enter the name of a file (for example "myfile") without the extension Field 2 is the file upload field where you upload a ZIP folder with different files. Validation check In this simple example it will be checked if there is a file with the filename entered in field1 present inside the files uploaded in field 2. In other words: Check if the uploaded ZIP folder contains a file with the filename for example "myfile" in this case. If yes, then the form submission is successful, otherwise an error will be shown at field 1. This is only a simple scenario to demonstrate how a custom validation could be done. You have to write your own validation rules. Now lets write some code for this example: The first one is the custom validation rule. Please add this code to your site/init.php. If this file does not exist, please create it first. <?php namespace ProcessWire; \Valitron\Validator::addRule('checkFilenameInZip', function ($field, $value, array $params) { $fieldName = $params[0]; // fieldname of the upload field $form = $params[1]; // grab the form object // get all the files from the given ZIP folder as an array $zipfiles = $form->getUploadedZipFilesForValidation($fieldName); // now start a validation rule with the value of this input field ($value) and the files inside the ZIP folder if (!is_null($zipfiles)) { $fileNames = []; foreach ($zipfiles as $zipfile) { $fileNames[] = pathinfo($zipfile, PATHINFO_FILENAME); } return in_array($value, $fileNames); } return true; }, 'must be a wrong filename. The ZIP folder does not contain a file with the given name.'); I have named the validation rule "checkFilenameInZip" in this case. The important thing is that you have to add 2 values to the $params variable: The name of the field should be validated against the file upload field - in this case the name of the field containing the file name The form object itself To get all the files that were uploaded via the upload field, you can use one of these methods of the form object. getUploadedZipFilesForValidation (outputs only files of a ZIP file) getUploadedFilesForValidation (outputs all files of a file upload field) Important: To use these 2 new methods you have to update to the latest version of FrontendForms (2.3.14)! All ZIP files will be extracted automatically. Nested ZIP files are supported too. Now lets create the form $form = new \FrontendForms\Form('testform'); $form->setMaxAttempts(0); // set 0 for DEV $form->setMaxTime(0); // set 0 for DEV $form->setMinTime(0); // set 0 for DEV $form->useAjax(false); // set false for DEV // input field containing a filename $filename = new \FrontendForms\InputText('filename'); $filename->setLabel('Name of file'); $filename->setNotes('Please enter the name of the file without extension.'); $filename->setRule('required'); $filename->setRule('checkFilenameInZip', 'fileupload1', $form);// here is the new custom validation rule: Enter the name of the file upload field as the first parameter and the form object as the second parameter $form->add($filename); // the file upload field $file1 = new \FrontendForms\InputFile('fileupload1'); $file1->setRule('required'); $file1->setLabel('Multiple files upload'); $form->add($file1); $button = new \FrontendForms\Button('submit'); $button->setAttribute('value', 'Send'); $form->add($button); if ($form->isValid()) { // do what you want // $extractedFiles = $form->getUploads(true); // returns all uploaded files including extracted ZIP folder files // $nonExtractedFiles = $form->getUploads(); // returns all uploaded files but Zip files are not extracted // $values = $form->getValues(); // returns all submitted form values } echo $form->render(); Copy this code inside a template for testing purposes. Upload a ZIP folder and add the name of a file inside the "filename" input field. If the file exists in your ZIP folder you will succeed. Please note: The extraction of the ZIP files is done only once during the validation process. You can get the extracted files afterwards inside the isValid() method via the getUploads() method from the temporary upload folder. Use the return of this method to do some more work with the uploaded files. Take this example as a starting point for your own validation rules and let me know if it works for you. I think this is the only possibility to get what you need. Another hint: User browser validation in FrontendForms to make client side validation first by enabling it in the backend.
  4. Yesterday
  5. I loved this theme - very similar to the new one, but somehow better. I actually prefer Bernhard's stock UIKit theme to the new one, not sure exactly why. I wish Canvas was the default theme.
  6. 50 Templates + 14 Repeaters 🙂
  7. I'll see if I have time to do a full case study. The map is easily explained though: Since Switzerland is a very small country, stretching it onto a 2D plane can be done without much distortion. That's where the LV03 and LV95 coordinate systems come into play. They are centered at the observatorium of the ExWi building of the University of Bern (where I studied CS :P). From there, you count the meters to the north and the east (and add some offsets so there are no negative coordinates). Using Switzerland's official map service, you can easily come up with LV95 coordinates for any address. These are then added to the locations in the PW admin. The map thus is just an SVG and placing the dots is just simple LV95 coordinate to pixels interpolation. No external services needed, no privacy concerns.
  8. Shocking stuff. Perhaps a good title would be Another great reason not to use WordPress. 🙂 In PW world, how many of us run Module updates through any audit before installing?
  9. I wasn't realy planning to, we'll see! R
  10. Last week
  11. You can try to compare the Textarea field settings. I have seen this behaviour when the editor setting uses a faulty js / css file path. Maybe a custom JSON file have been moved.
  12. Very useful, indeed! May I suggest an example in its docs for the developer to implement: - A URL segment `/md/` or, even better, adding `.md` to the URL to trigger the display of the markdown version of the page?
  13. 😂 https://www.tomshardware.com/tech-industry/artificial-intelligence/claude-code-deletes-developers-production-setup-including-its-database-and-snapshots-2-5-years-of-records-were-nuked-in-an-instant EDIT, the post-mortem by the developer: https://alexeyondata.substack.com/p/how-i-dropped-our-production-database
  14. I presume, then, if you know it's not animated and you want the webp version you can use ->webp. It's probably good as it is in hindsight.
  15. @wbmnfktr thanks, 2 issues fixed. The last one was not a syntax the module supports (method syntax rather than property syntax) but added support for it in the latest commits with PW's call unknown() method catchall.
  16. Trying that out (using $pages->get("/home/landing")->introimg_field instead of $item->introimg_field) : <?php foreach($pages->get("/home/landing")->introimg_field as $intro_image): ?> <a href="<?php echo $intro_image->page_picker->url; ?>"> <h3><?php echo $intro_image->title; ?></h3> <img src="<?php echo $intro_image->image->url; ?>" alt="<?php echo $intro_image->description; ?>"> </a> <?php endforeach; ?> It shows up in Firefox, but not in Edge. If I revert back to $item->introimg_field, it keeps working. For now.
  17. dragan

    I'm back

    @Soma Welcome back!
  18. I'm thinking a stand-alone repo? If it's going to be a solid design language reference and referenced by other modules and developers, it should be separate. What's your feeling?
  19. I was just thinking this when @Soma reappeared. I've been using MSN too on every project I've ever created and never had an issue with it.
  20. I heard that too. If I’m not mistaken though, you can have 10,000 views per month free. https://mapsplatform.google.com/lp/maps-apis/#pricing
  21. Wow. This is incredible. Thank you for how thorough it appears to be.
  22. Fantastic, thanks Robin.
  23. @maximus, thank you for all the modules! Just to let you know: there are 2 occurences of formatBytes() in Context.module.php
  24. PromptWire MCP (new name) is now public on Guthub. Use at own risk 😀 https://github.com/PeterKnightDigital/PromptWire-MCP PromptWire MCP for ProcessWire (blog introduction) Documentation can be found here. https://www.peterknight.digital/docs/promptwire/v1/ Enjoy 😊
  25. Quick update — pushed v1.3.0 today. Added dark mode support (all colors follow AdminThemeUikit CSS variables automatically) and interactive filtering: click any row in Pages, Sources, Geography, Devices, or Browsers to filter all widgets at once. Active filters show as removable tags at the top of the dashboard and are stored in the URL. Thanks @bernhard GitHub: https://github.com/mxmsmnv/PlausibleAnalytics
  26. Hi everyone, I needed a solid subscription module for a client project — something that handles multiple lists, double opt-in, and plugs cleanly into order and contact forms via a PHP API. Nothing in the directory quite fit, so I built Subscribe. It's been running in production on a few sites since March, so the edge cases are ironed out. GitHub: https://github.com/mxmsmnv/Subscribe What it does: Multiple subscription lists with many-to-many subscriber relationships Double opt-in with configurable HTML email ({confirm_url}, {unsub_url} placeholders) Honeypot spam protection — no CAPTCHA needed IP-based rate limiting (configurable threshold and time window) One-click unsubscribe with unique token per subscription WireMail provider selector — works with default, SMTP, Brevo, or any WireMail module Admin UI (Setup → Subscribers): Sidebar list switcher with subscriber counts Add/toggle/remove subscribers, create/rename/delete lists Search, status filter, pagination CSV import, JSON/CSV export per list Resend confirmation for pending subscribers PHP API — drop it into any template, order form, or contact form: $sub = $modules->get('Subscribe'); $sub->subscribe('user@example.com', $listId); Hookable event for integrations (Telegram notifications, CRM sync, etc.): $wire->addHookAfter('Subscribe::subscribed', function(HookEvent $event) { // $email, $listId, $subscriptionId }); Ships with an Alpine.js form block ready to drop into any template. Requirements: ProcessWire 3.x, PHP 8.0+ MIT License.
      • 13
      • Like
      • Thanks
  27. Hi all, sorry haven’t been around Processwire in a while as I’ve been doing games and AI ethics work mostly these days. If you want some more things to read and hear then check out my podcast on the subject or my article about the end of programming…. Yep 🫠 Machine ethics podcast Programming is dead, we’re all code engineers now
  28. Update: Improved "Link Module" UX We had an internal discussion about the "Link Module" interface and optimized how the different states are handled: Match found – The repo is resolved and ready to link. The green link opens the repository on GitHub so you can verify it's the right one before linking. This appears instantly when the module declares its GitHub URL in getModuleInfo() or has been resolved before (cached), otherwise after a quick GitHub search. No repo found – ProModules like RepeaterMatrix have no public GitHub repo. GitSync shows a clear "No repositories found." instead of false matches. Multiple repos – When a module exists in several repos (forks, different maintainers), you get a list to pick from. Selected, with "change" – After picking one, a "change" link lets you switch. It only appears when there are actually alternatives. Other improvements: single results are now auto-selected (no unnecessary click), the GitHub search uses Code Search API for exact .module.php filename matching (works even when repo name ≠ class name), and results are cached client-side so re-selecting a module is instant. Cheers, Mike
  1. Load more activity
×
×
  • Create New...