Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/03/2020 in all areas

  1. We've been expieriencing high load for some reason for the past 12+ hours though not sure where it's coming from as yet. As a result the site has been slow/showing error messages. The site and forums are up for now but please bear with us whilst we investigate.
    3 points
  2. Heya! Just released Wireframe 0.9.0. Here's the changelog for this version: ### Added - New EventListenerTrait. Currently used by Components only. Adds support for listening to and emitting events. - Support for Renderer modules for adding templating engine support for view files, component view files, etc. - New Page methods Page::viewTemplate(), Page::getViewTemplate(), and Page::setViewTemplate(). - New method Component::getData() for manually defining the data passed to the component view. ### Changed - Controller::init() and Controller::ready() are now hookable methods. - Component::setView() and Component::getView() are now final methods, preventing accidental overrides. - Layout file is no longer necessary; if it's missing, the page can be rendered using just a view file. The component system is a bit more mature now, and there are a couple of new features: Component::on('event-name', callable $callback) can be used to listen to events emitted by a Component instance, and in a Component class events can be emitted with $this->emit('event-name', array $args). This is mostly just syntactic sugar on top of the hook system, but it seemed fun and potentially useful, so... ? The Component base class extends WireData, so by default what gets sent to the component view when a component is rendered is the internal $data array. Since 0.9.0 it's possible to alter this behaviour by implementing getData() method which returns the data that the component should expose to its view. Another "big" update is support for renderers. These are add-on modules that add support for different rendering / templating engines to Wireframe, and the first example is the Wireframe Renderer Twig module. I haven't really used a templating engine in a while so it's possible that I've missed something important, but in my limited tests the Twig engine seemed to work quite well right out of the box. I'll likely add a separate module for Latte at some point, just to make sure that the logic works for other engines as well ? By the way, it looks like I forgot to post here about Wireframe 0.8.0. It was released last month, and here's the related changelog entry: ### Added - Support for Components, along with a new static factory method Wireframe::component($component_name, $args). - Support for rendering pages that have not been "routed" to Wireframe using the altFilename template setting. - New static getter/factory/utility method Wireframe::page($source, $args). - New static utility method Wireframe::isInitialized(). ### Changed - Wireframe::$initialized is now a static property. This was a necessary change so that Wireframe::isInitialized() could be implemented effectively. On a related note I'm considering tagging the next release as 1.0.0. We've been using Wireframe on production sites for a while now, and I can't recall any truly breaking changes so far, so I think it's already quite stable ?
    3 points
  3. UPDATE 2020-02-03 SnipWire 0.8.1 (beta) released! This update mainly serves to move all custom classes into their own namespaces! This should fix the annoying class naming conflicts with other modules. Its now time to put some effort into the SnipWire docs!
    2 points
  4. One disadvantage of Klaro: Custom styling is possible, but takes some effort, and also overhead because the default styles are embedded in the script. It would be better if the default CSS is optional. You can override the custom styles if you apply a data-attribute to the klaro script. Here is what I did. Cloned the git repo and removed including the SCSS file in the script. Then compiled the SCSS with my customizing as a separate file.
    2 points
  5. We’ve got several updates on the dev branch this week, but I want to finish one more of them before bumping the version to 3.0.150, so will likely do that next week. The biggest change this week is the addition of a new core class called FieldsTableTools. This will be used internally by the $fields API variable for manipulating field table schema in the database, and its methods are accessed from $fields->tableTools(); Though this is one you probably won't be using from the API unless developing Fieldtype modules, so if you just want to know what the benefits are, feel free to skip to the last two paragraphs. Initially these methods are primarily focused on managing unique indexes for fields, though will expand to manage other schema manipulations as well. An example of its utility is also included in this week’s commits—our email fields (FieldtypeEmail) now have the ability to enforce uniqueness at the DB level. If you edit an email field (Setup > Fields > email) and click on the Advanced tab, there’s now a checkbox there to enforce unique values, ensuring that a given email address cannot appear more than once (i.e. not appear on more than one page). The same ability will be added to text and integer fields (FieldtypeText and FieldtypeInteger) as well, but we’re starting with the email field because it’s needed for an update hopefully wrapping up next week: the optional ability to login to the admin with your email address. Having a unique index on a DB column is actually a pretty simple thing, but as it turns out, it takes a lot of code to support the ability in an existing installation. That’s because we have it as something you can toggle on and off (on that Advanced tab), and when you toggle ON a unique index, there can’t be any duplicate values in the existing data, or the index will fail to apply. So there’s a lot of supporting code in FieldsTableTools to do things like detect and warn about duplicate values, delete empty values before adding the index, identify when the index is present without querying the table, reporting error conditions in a manner that understandable and recoverable, as well as the actual schema manipulations that add or remove the index. I realize this sounds a bit technical (and that's partly why I'm not putting this in a more formal blog post), but I think most developers will at some point find it very useful in building sites and applications. Not only will it enable us to safely support login-by-email in the admin (coming next), but it’ll be useful in any situation where you need to prevent a value from repeating. Whether that is in preventing double bookings for a date, location, seat, etc., or preventing any kind of redundancy like post titles, author names, product titles, phone numbers, or codes (UPC, ISBN, ASINs, EIN, SSN, etc.), this feature can come in handy. And supporting it at the DB level is a lot more solid than supporting it at the code level. Right now it’s just supported in email fields, but all of the logic has been delegated to the newly added class so that we can easily support it in any other fields (with text and integer fields coming next). Following that, the $fields->tableTools(); will also be gaining methods for modifying other types of field schema. For instance, rather than just supporting the INT column type for integer fields, wouldn't it be nice to go to Setup > Fields > [some integer field] and select both unsigned and signed integers of different types: TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT, for any new or existing integer field? MySQL also offers a similar array of size variations for other types that would be useful in our text and textarea fields, among others. So you'll be continuing to see ProcessWire offer more options for existing FIeldtypes in future core versions, enabling you to more efficiently store and manage content in PW. But of course we'll do it in a way that keeps it simple, ensuring that you don't have to think about these things unless/until you want or need them.
    1 point
  6. I love TracyDebugger, but today I had a hard time debugging some stuff and tried XDebug to get support for breakpoints. It was a quite straightforward setup: create a file on your server and output phpinfo() Copy the content of this page to the wizard: https://xdebug.org/wizard.php DON'T follow the instructions there, it's simpler with laragon (choose your files and paths of course): Download php_xdebug-2.6.0-7.1-vc14-x86_64.dll Move the downloaded file to C:\laragon\bin\php\php-7.1.14-Win32-VC14-x64\ext Enable xdebug via laragon check if everything worked by visiting the phpinfo() page again - it should show a section about xdebug now enable validaton in vscode by adjusting the user settings: "php.validate.enable": true, "php.validate.executablePath": "C:/laragon/bin/php/php-7.1.14-Win32-VC14-x64/php.exe", "php.validate.run": "onType", install "PHP Debug" extension by Felix Becker and read the instructions enable remote debugging by xdebug by adding this to your php.ini [XDebug] xdebug.remote_enable = 1 xdebug.remote_autostart = 1 create a testfile, eg home.php and set the debug config to "PHP" add breakpoints and start debugging by pressing the green play icon reload your page in the browser and the debugger will stop on lines 2 and 3 where we set the breakpoints. open vscode (if you don't have two screens) and follow code execution step by step. There are also some videos on youtube: https://www.youtube.com/watch?v=poty5nKk2m4 If XDebug slows down your server you can simple enable/disable it via laragon. This will require only two clicks and reload apache automatically
    1 point
  7. Inputfield Selector Select ID Uses the Page List Select inputfield for user-friendly input of page IDs into Inputfield Selector. Overview This module adds a feature to Inputfield Selector, which is most commonly seen in Lister (Find) and Lister Pro. When adding a filter row for "Parent", "Has parent/ancestor" or "ID" the user is expected to enter a page ID to match against. But this is not as user-friendly as it could be because the user may be able to identify the desired page by its title or location in the tree but not know its ID. This is particularly the case for site editors who may not even understand the concept of a page ID. So this module adds a thunderbolt icon to relevant rows in Inputfield Selector. When the icon is clicked a Page List Select inputfield opens in a modal window, allowing the user to visually select a page from the tree. When the modal is closed with "OK" the ID of the selected page is inserted into the filter row. Tip After a page selection has been made in the modal window the "OK" button will automatically receive focus so if you prefer you can close the modal by hitting the Enter key rather than mousing to the OK button. Installation Install the Inputfield Selector Select ID module. https://github.com/Toutouwai/InputfieldSelectorSelectID https://modules.processwire.com/modules/inputfield-selector-select-id/
    1 point
  8. Solved! I just release an update which moves all custom classes into custom namespaces. Thanks for your help!
    1 point
  9. Have given Media Library a look?
    1 point
  10. Hey @adrian, What do you think about the idea of adding a link to the "Restore" page somewhere within the main interface? I know it's accessible via the flyout menu but it's easy (for me at least) to overlook or forget this and there have been a few times where I've started to worry that I don't have the ability to restore a backup when an action fails due to an error or I've navigated away from the success screen which includes the restore link. Then after a moment I remember where the link is and breathe a sigh of relief. ?
    1 point
  11. Did the same some time ago, as PW 3 was released. Replaced the wire folder, and that was it.
    1 point
  12. Thanks for working on FieldsTableTools, supporting uniqueness at the DB level is an important addition to the system for sure! However, while you are at it, please also consider this HIGHLY POPULAR request: https://github.com/processwire/processwire-requests/issues/126 Looks like this is the right moment for you to also implement a decimal fieldtype for the core.
    1 point
  13. That's correct. It's a bit of a nuisance, admittedly, but I don't consider it a huge issue. It's a whole different deal when we're talking about other bundled classes – in the case of Wireframe, for an example, I already have View, Component, Controller, and Config, which would be very likely to cause issues if they weren't namespaced. In fact most of my own recent modules come with a Config class... ? Honestly: I would probably leave the module name as-is for the time being, but at some point in the (perhaps near) future add a custom namespace and declare 3.0.150 as a dependency. But obviously it's your call – if you want to do your best to avoid any issues right now, renaming would be a safe bet. It'll force existing users to likely reinstall, but that's unlikely to become a massive issue. 50-50 ?
    1 point
  14. That's true, and one reason why historically all module files have been declared in the ProcessWire namespace – another being that most modules don't need that many classes to begin with. In cases where a module makes use of non-module classes, I would definitely recommend defining a separate (i.e. something other than ProcessWire) namespace for those ? (This part is also well supported, so no need to wait for 3.0.150.) Just for an example, here's how I've handled this in Wireframe: Here's the classLoader setup: https://github.com/wireframe-framework/Wireframe/blob/6530b96/Wireframe.module.php#L297:L317 In this case Wireframe "core classes" live in the /lib/ directory: https://github.com/wireframe-framework/Wireframe/tree/master/lib While namespaces are often enough to tackle the issue of clashing traits and classes, it's also a common recommendation for traits and interfaces to be named differently: SomeNameTrait, SomeNameInterface, etc. PSR also recommends (or requires, really) this approach.
    1 point
  15. I might be able to hack together a release later today that moves things into a different namespace — given it all works out.
    1 point
  16. Have you tried the Migrations module? It's a bit of overhead to create migrations classes instead of using the admin UI, but it's nice to have reproducible template and field changes across all environments. Then you'd only need to mirror or sync /sites/assets/files/ and /site/templates/ somehow.
    1 point
  17. I love this module! I'm wondering though, how to make this easier as we build out a site's cms. Is there a way for when I'm working locally and I create new fields or have some new CMS content updates locally, is there a way to sync up or easily push this to the cloned remote site's database without having to create a whole new backup, upload, create db all over again on the second server?
    1 point
  18. UPDATE: Solved. I had gulp and the browsersync node module running while I packaged up which added a weird script in the installer.php page. I found it and removed it and re-ran. All good now. When I upload the package and installer and go to the installer.php file on the server i get this error: Parse error: syntax error, unexpected '__bs_script__' (T_STRING), expecting ',' or ';' in /...n/installer.php on line 334
    1 point
  19. I'm using the standard AdminThemeFramework::getUserNavArray hook. Looks like that's a newer addition and not available on default. Any particular reason you're still using the default theme? I switched all of my client sites over to UiKit and I don't regret it. The old one looks so... old.
    1 point
  20. @matjazp I added fixes for both issues you're describing. Check out the latest commit on the develop branch. These will be part of the next release.
    1 point
  21. @zoeck Slow day in the office — I added the editMode and viewMode options to the PageList panel as well. See the latest release. $panels->add([ 'panel' => 'page-list', 'title' => 'Information', 'data' => [ 'parent' => 'template=basic-page, name=info', 'editMode' => 'modal', 'viewMode' => 'blank', ], ]);
    1 point
  22. You're right of course ? I have a custom panel that already includes the modal script, so I never noticed. I pushed a fix that should work. Thanks for debugging!
    1 point
  23. You Added it to "renderButton" in the "DashboardPanel" Class, but the Modal is used in the "renderPageActions" Function in the "DashboardPanelCollection.module" (The renderButton/renderFooterButton isn't used in the Collection) When you add "$this->includeModalScripts();" to "if (self::windowModeModal === $mode) {" (Line 300) it works ?
    1 point
  24. @gmclelland I can see this getting a bit out of hand with a CMF like ProcessWire that doesn't set any boundaries on the shape content can take. The most versatile solution would be to create an at-a-glance panel, but to rely on the programmer to supply the counts that are relevant to their site. I can see the template and role counts working the way you suggested. Still, not all templates are meaningful units of content, e.g. a `country` template for populating forms is really not that interesting to site editors. The role naming / pluralization would only work in English here (e.g. vendor becomes Vendors), so there'd need to be a way of naming them in other languages. The documents and images are a bit more complicated, however. ProcessWire doesn't have a central media or file library to get a count from. So you need to run a cronjob to scan the site for images across all pages. You'd also need to figure out which images are meaningful content (photos) and which are e.g. system-created QR codes for event invitations. How do you count videos? I have a file field called videos, and a repeater field with a video_url field. There's no way of counting that without doing it yourself. Don't get me wrong, I like the idea, but I don't think automating it is feasible or the right solution in ProcessWire. I'll be happy to be convinced otherwise ?
    1 point
  25. @Jens Martsch - dotnetic @Macrura Come to think of it, I could check if the config array has numerical keys, and in that case treat them as an array of configs.
    1 point
  26. @Jens Martsch - dotnetic @Macrura Correct. The problem here is that the config object is an array, and the outer array is also an array. There's no way of telling if it's a config array or a collection of config arrays without it getting ugly. Luckily, WireArray has an import() method for that exact purpose. I added a release on GitHub that supports adding an array of panels via $panels->import([]);
    1 point
  27. I'm planning on revamping the documentation at some point — split it into sub-pages and make it more navigable. Next on the list is an example section with code snippets for all panels, as you suggested.
    1 point
  28. I could make that a bit more obvious in the documentation ?
    1 point
  29. @zoeck I implemented modal editing for the collection panels. See the latest release. You can set the mode to modal or blank for edit or view links. The modal auto-closes on page save and the panel reloads via AJAX when an edit modal closes. /* Open edit links in modal, view links in new tab */ $panels->add([ 'panel' => 'collection', 'data' => [ 'editMode' => 'modal', 'viewMode' => 'blank', ], ]);
    1 point
  30. Hi guys and girls! And thanks for Processwire! Just to give some help with Google account settings for WireMailSMTP. They are pretty well known... but Google appears to reject SMTP authentication from "non-trusted apps". There's however a solution which doesn't make Processwire "more secure" (from Google point of view) but unlocks the possibility of sending mails by WireMailSMTP using a Google account. You need to enable 2-factor authentication for Gmail account which You want to use with WireMailSMTP. You need to generate an "app password" different from Gmail account password. This "app password" should be used as SMTP password while setting WireMailSMTP up. Bingo! No more blocking. P.S. In my case, that Google blocking was occuring even if i tried to send a single letter per day. I'm not sending spam, just notifications for website owner/manager.
    1 point
×
×
  • Create New...