Jump to content

ryan

Administrators
  • Posts

    16,484
  • Joined

  • Last visited

  • Days Won

    1,464

Posts posted by ryan

  1. This week we've bumped the ProcessWire dev branch version to 3.0.239. Relative to the previous version, this includes 15 commits. This version is required if you decide to test out the new PageEditChildren module, which has also been released in the ProFields board today. I'm not sure it'll remain in the ProFields set of modules, as it's not even a field. But after spending multiple days updating ProFields modules to be compatible with it (also posted today), I thought it was best to keep them together for the short term. It's easier for me to support that way at least. Longer term, it may even become a core module. 

    There's also a couple other modules in ProFields right now that I'm planning to move into the modules directory and GitHub. These most likely include TextBlocks, AutoLinks, and potentially FunctionalFields. These modules have not required much in terms of support resources in awhile, so may not need to be part of ProFields any longer. Thanks for reading and have a great weekend! 
     

    • Like 15
    • Thanks 2
  2. Quote

    sorry I was not very clear. I was talking about two buttons while editing a page, that go to the next/previous page (with same parent)

    @jploch The next/previous children pages are actually all present already, so a next/prev is a matter of moving your mouse 40 pixels down or up. But it's possible I still don't understand what you mean in this particular context. I'll try to get a beta of this module ready shortly, and once you've had a look at it let me know if the next/prev that you are thinking of still applies. 

    • Like 1
  3. @Robin S I was thinking that since a JS callback is necessary to make it do anything, it was simplest just to keep it all JS, contained to one definition. At least for the case that prompted adding this feature (PageEditChildren module). But for cases like what you are describing, what you say makes a lot of sense. I will add an $inputfield->addHeaderAction([ ... ]); that does the same thing, maybe like these examples?

    // click action
    $inputfield->addHeaderAction([
      'icon' => 'hand-stop-o',
      'overIcon' => 'hand-peace-o',
      'tooltip' => 'Hello world',
      'event' => 'myEvent'
    ]); 
    
    // toggle action
    $inputfield->addHeaderAction([
      'onIcon' => 'toggle-on',
      'onEvent' => 'MyOnEvent',
      'onTooltip' => 'Click to toggle off',
      'offIcon' => 'toggle-off',
      'offEvent' => 'MyOffEvent',
      'offTooltip' => 'Click to toggle on',
    ]); 
    
    // link action
    $inputfield->addHeaderAction([
      'icon' => 'fa-link',
      'href' => 'https://processwire.com/api/ref/',
      'tooltip' => 'API reference',
      'target' => '_blank', // or 'modal' or omit for '_self'
    ]); 

     

    • Like 7
  4. I've been continuing to work on the PageEditChildren module that I wrote about here last week. This week a "Clone" feature was added. You can click the Clone action and it'll create a copy of the page below the one you cloned, and then make it immediately editable before you even have to save.

    image.png

    This Clone action is an example of an Inputfield header action, and it accompanies the Move, Pub/Unpub and Trash actions for each page in PageEditChildren. I thought this ability to add Inputfield actions seemed useful beyond just this module, so the ability has been added directly into ProcessWire's core Inputfields JS API. 

    If you grab the current dev branch of ProcessWire, you can test it out if you'd like. You can paste these examples in your web browser's Javascript console. But in actual web development, you'd likely put these in a separate JS file that is added to your page editor with a hook. 

    Open the page editor to any page, then open your Javascript console in your web browser, and then paste this in:

    Inputfields.addHeaderAction('title', {
      icon: 'fa-hand-stop-o',
      callback: function() {
        ProcessWire.alert('Hello World!'); 
      }
    });

    That should add a hand icon to your "Title" field header, and if you click it, it'll pop-up a dialog box that says "Hello World". 

    Let's say you wanted it to show a different icon when you hover it, and also to show tooltip text via a title attribute.  You can add the 'overIcon' to specify what icon to show on mouseover, and 'tooltip' to specify the tooltip text:

    Inputfields.addHeaderAction('title', {
      icon: 'fa-hand-stop-o',
      overIcon: 'fa-hand-peace-o',
      tooltip: 'Hello world',
      callback: function() {
        ProcessWire.alert('Hello World!'); 
      }
    });

    Above are examples of 'click' actions. We also support toggle or "on/off" actions:

    Inputfields.addHeaderAction('title', {
      onIcon: 'fa-toggle-on',
      onTooltip: 'Click to toggle off',
      onCallback: function() {
        ProcessWire.alert('You toggled on');
      },
      offIcon: 'fa-toggle-off',
      offTooltip: 'Click to toggle on',
      offCallback: function() {
        ProcessWire.alert('You toggled off');
      }    
    });

    Toggle actions like this are primarily what is used by the PageEditChildren module to handle the Published vs Unpublished state, and Trash on/off state. Whereas "Clone" is an example of a Click action. Our callback functions in the examples above are very simple alerts, but of course you could make it do anything you want in those callbacks.

    Also added this week to the Inputfield JS API was an update to the Inputfields.label() function that now allows you to set the label for an Inputfield (previously it could only get the label). 

    This is a bit of a contrived example, but since we were talking about header actions above, let's demonstrate the label() function within a header action. This example adds an action that lets you edit the Inputfield label:

    Inputfields.addHeaderAction('title', {
      icon: 'smile-o',
      callback: function($f) {
        ProcessWire.prompt('Enter new label', 'Label', function(val) {
          if(val) Inputfields.label($f, val);
        });  
      }
    });

    By the way, there's a lot more to the Inputfields JS API, and it's all documented directly in ProcessWire's inputfields.js file. 

    I'll be bumping the core dev version next week to hopefully accompany the first version of the PageEditChildren module. Thanks for reading and have a great weekend! 

    • Like 12
    • Thanks 4
  5. @MarkE There's definitely a lot of potential for this to evolve over time. Another example is that it can edit any pages this way, not just children. For that reason, I put in a hook: ___getChildren($page) so that anyone can override what are the "children" for the page. If there is hierarchy, such as there would be if the selector "parent_id=$page" were changed to "has_parent=$page", then I agree the way repeaters do hierarchy could work here too. But I figure the best bet is to keep it simple, focused and straightforward at first to get to a stable version 1, and then start evolving it to do more after that, if there's interest. 

    • Like 5
  6. With the current project that I'm working on, there's eventually going to be an enormous amount of data to edit within it (in ProcessWire), and so I've been looking for ways to optimize and facilitate the editing experience. The goal is to save the people editing as much time as possible, and reduce the number of steps necessary to make common edits. This is what motivated the recent Table field updates. The is also what motivated a new module I'm working on called PageEditChildren.

    The PageEditChildren module takes the existing "Children" tab in ProcessWire's page editor and replaces it with a new one that lets you edit all of the child pages inline, directly from the parent page. For specific cases, such as the one shown in this video (below), this provides a more convenient way to edit multiple pages at once. It can significantly reduce the amount of back-and-forth between the page editor and the page list, or multiple page editors, keeping it all in one page editor session. 

    Likely you would use this module to replace the "Children" tab on just some (not all) pages. Specifically, pages where the relationship between parent and children is one where they are often edited as a group. This is a fairly common use case in ProcessWire, and one where this module can save you a lot of time. From an editing standpoint, it has a lot in common with repeaters. 

    Other modules that have some crossover are PageTable (core) when configured to create/edit children pages, and BatchChildEditor. Both use page editors in modal windows to accomplish editing children, a different approach than PageEditChildren, which keeps it all part of the single page editor. Though BatchChildEditor can edit title and status (hidden/unpublished) inline, and supports CSV export/import options, among other useful tools. All of these modules are worth consideration when there is a need to optimize the editing experience between parent and children.

    This is just an early preview of PageEditChildren, so I'm going to work on the module and test it out a bit more before releasing it. But it could be ready to share as soon as next week. Supporting file/image and repeater fields in this module required some minor core improvements, which are in this week's core updates. I'm interested to hear your thoughts on whether this would be useful in your sites as well? More next week. Thanks for reading and have a great weekend!

    • Like 25
    • Thanks 2
  7. This week we have another update to the ProFields table field. A couple of weeks ago I wrote a blog post about Table v28 and the new actions features that it added. I've been working with Table a lot for my current client project, and have found these new features very useful. But I'm doing a lot of data entry in Table and found I still wanted more. Specifically, I wanted to be able to apply some of the actions directly on the row I was working in (rather than having to select it and then scroll down to the actions). Kind of like how one can click the Trash icon on any row to delete the row... I wanted to be able to apply other actions in the same way (Add, Clone, Copy, Paste). And Table v29 (released today) does exactly that. 

    Another desire I had is for the for row-level actions to be just really simple, with not too much to look at... something folks could use rapidly without having a lot to read. This leaves several powerful and verbose features for the actions menu you saw earlier (the one that appears under the Table). 

    Below is a video that outlines these new row-level actions. It's actually the same video from before, but I added to it for the version 29 features. So I'll try to post a link that starts at the timecode of the new stuff. But if you haven't seen this video before, you may want to rewind to the beginning.

     

    Below is the full CHANGELOG for this version:

    Expanded actions support so you can also execute actions directly on individual rows, which is often more convenient than selecting rows and then applying actions.

    Hold down the SHIFT key before clicking the row actions select and it will convert any actions that usually append rows to instead prepend rows. This works with the the Add, Clone and Paste actions when clicked at the individual row-level. It also works with the Select action for selecting multiple rows at once. The Select action is there in part for people that may not realize you can already click the sort arrows to select the row. 

    Removed the Vex dialogs when copying or pasting and replaced them with other visual cues to indicate successful copy and/or paste. 

    Added a new config option for disabling the DELETE (trash) icon on individual rows when individual row actions are enabled. This is because the row actions already include a delete action, so the trash icon can be redundant for some who might prefer the additional space. 

    For all non-page selection column types, a new "Settings" option was added (named “formattedValueType”) to indicate how the value should be represented when accessed from a formatted page. Previously the API value was always the selection value. Now you can specify that it should include both the value and label (in your choice of array), or just the label rather than the value. 

    Table v29 beta is available for download now in the ProFields download thread. More core updates are likely for next week. Thanks for reading and have a great weekend!

    • Like 9
    • Thanks 5
  8. This week we have ProcessWire 3.0.238 on the dev branch. This version contains 17 commits containing new features (some via feature requests) as well as issue fixes. Recent updates have been nicely covered in ProcessWire weekly issues #517 and #518. Also added this week are the following:

    • Improvements to ProcessPageClone, which now supports some new options such as the ability to configure it to always use the full clone form (a requested feature), and an option to specify whether cloned children should be unpublished or not.
       
    • New $datetime->strtodate($date, $format) method that accepts any PHP recognized date string and reformats it using the given format. It also supports date strings that PHP doesn't recognize if you give it a 3rd argument ($options array) with an `inputFormat`. The existing $datetime->strtotime() method now supports an `inputFormat` option as well.
       
    • The Inputfield class now has new methods: $inputfield->setLanguageValue($language, $value) and $inputfield->getLanguageValue($language), added by the LanguageSupport module. Previously there were no dedicated methods for this, so you had to manage them with custom keys containing language IDs if you wanted to programmatically use an Inputfield in multi-language mode.
       
    • The ProcessWire.alert() JS method has been updated with an auto-close option (`expire` argument) that automatically closes the alert box after a specified number of seconds. 
       
    • InputfieldDatetime has been updated with 7 new interactively configurable settings for the jQuery UI date picker. See the screenshot below for an example of a few. Plus, its API has been updated with the ability for you to specify or override any jQuery UI datepicker option, either from PHP or JS, as requested by Toutouwai/Robin S. See the new datepickerOptions() method and phpdoc for details. 

    image.png

    Next week we've also got some more updates to InputfieldTable that take the newly added actions even further and make them easier to use. Thanks for reading and have a great weekend! 

    • Like 19
    • Thanks 1
  9. @TomPich I wouldn't recommend caching a field value like that, as I don't think you'll get any performance benefit since the amount of work for PW to do is the same either way there. What I'd recommend doing instead is caching the resulting output, which also means only loading the repeaterConsultants when it will be used to generate that cached markup. Whatever markup you generate, use that as your cache value, for example:

    echo $cache->get('consultants', 'hourly', function() use($pages) {
      $out = '';
      $consultants = $pages->get(1027)->repeaterConsultants;
      foreach ($consultants as $consultant) {
        $out .= "<li>$consultant->consultantName</li>";
      }
      return "<ul>$out</ul>" ;
    }); 

     

    • Like 2
    • Thanks 1
  10. @iank I had a look at this and it seems like it can happen if you omit homepage language segments, and are also using the PagePathHistory module. What happens is that PagePathHistory provides a shortcut for finding the page, leaving no language segments for PagePathHistory to detect the language. I don't think PagePathHistory supported multi-language URLs until 3.0.186, so maybe that's when the issue started. Though the entire URL-to-page mapping system has been rewritten since 3.0.165 via the new PagesPathFinder class, so who knows. I think maybe it's not been reported before because just about everyone is using language segments on the homepage, and I always recommend doing so, but didn't intend to require it. I've attempted a fix on the dev branch, it's just one line of code, so maybe it'll work just to modify your copy too. Do you find this fixes it there? 

    https://github.com/processwire/processwire/commit/9e6b89cf9331fccb8f41ae0b1785e21c8c5d62f0

    • Like 2
    • Thanks 1
  11. On the dev branch this week are a few issue fixes, but also some new features. The "Parent" field in the page editor (Settings tab) now is contextual to the page's template family settings. Now it will just show you the allowed parents, if you've configured them in the template. Previously it would show you a page tree to select from anywhere in the site. This saves you time, as well as the hassle of getting an error message after save, should you select a parent that isn't allowed by the page's template family settings. 

    image.png

    Next, the page tree "Move" actions (that you see when hovering a page in the tree) are now a little smarter. Previously, these Move actions would appear for any page that was either sortable or moveable. But now it also checks how many other allowed parents there are, per template family settings. If there aren't yet any other potential parent pages existing in the site, the page is no longer considered moveable, and thus won't show a Move action. This useful addition was added per Bernhard's request, as was the addition to a couple new classes used in the page tree to better differentiate between public vs non-public pages... something that I understand Bernhard's admin style may soon demonstrate. 

    This week a question came up through email about how to make multi-language "required" fields require a value in all languages the page is active in. Currently multi-language required fields only require a value to be present in the default language. If you want to make them require all active languages, you can do so with a hook in /site/ready.php. I thought it was pretty useful so thought I'd share it here. Though maybe we'll have to add it as a feature. 

    if($page->process == 'ProcessPageEdit') {
      $wire->addHookAfter('Inputfield(required=1,useLanguages=1)::processInput', function($event) {
        $inputfield = $event->object;
        $page = $inputfield->hasPage;
        if(!$page) return;
        foreach($event->wire()->languages as $language) {
          if($language->isDefault()) continue;
          if(!$page->get("status$language")) continue; // skip languages not active on page
          $value = $inputfield->get("value$language");
          if(empty($value)) {
            $inputfield->error("Value required for language " . $language->get('title|name'));
          }
        }
      });
    }


     

    • Like 17
    • Thanks 1
  12. Pruning is kind of an expensive operation as it involves finding existing log entries, exporting them to a new file, then deleting the old file, then renaming the new file to the old filename. I'd avoid doing it every time you save a log entry. I prefer to manually prune from the admin. The error messages seem to indicate that maybe the prune is colliding with the save. Likely pruning immediately after saving is happening in the same timestamp and not giving it a chance to consistently save a log entry. So at the least, I would disconnect your prune() operation from your save() operation, perhaps moving your prune operation into a LazyCron::everyDay hook.

    • Like 2
  13. This week we have a new core version on the dev branch. Relative to the previous dev branch version, the new 3.0.237 version has 33 commits containing 20 issue fixes, 6 feature requests, and more. See the core updates section of ProcessWire Weekly 511, 512, 514 and 515 for more details. It's been about a month and a half since 3.0.236, which is a little longer than usual between version numbers, but that's largely because if the new Invoices site profile (see blog post). I'm off work tomorrow (Friday), so writing the usual weekly post a day early. As always, thanks for reading and I hope you have a great weekend! 

    • Like 17
    • Thanks 1
  14. That sucks, but I'm guessing they might make exceptions for some projects, so I'll have to ask them. Still, not nearly as much of an issue as what CKEditor did. But if it stays GPL and they don't make an exception for any projects, then most likely we couldn't include TinyMCE 7 with the core. In that case, we'd develop it was a non-core module, and folks would have to install it as a 3rd party module (in /site/modules/). ProcessWire's core is completely separate from what people develop or what they might add-on their site, so they don't have to share the same license. PW is built so that modules are independent of ProcessWire in the same way WP and PW are separate applications that can run on the same webserver, or a website is independent of the webserver that's delivering it, or a browser is independent of the HTML it renders or JS it executes.  https://processwire.com/about/license/3rd-party-files/

    • Like 9
  15. This week there is a new version of the Site Profile Exporter module released (ProcessExportProfile). This is the module that was used to export last week's Invoices Application Site Profile. While this module has been around for a decade now, this latest version makes some nice improvements, which I'll cover below.

    @bernhard pointed out to me that he's using the module to make a new site profile, but he found it cumbersome to enter all the profile information every time he wanted to export the profile. So this new version now lets you update an existing profile with 1-click, making it much easier to re-export a profile. 

    This version also adds a preview of what your profile will look like in the ProcessWire installer (the part where the user would select it for installation). Lastly, this version has several other small improvements and fixes as well. If you've ever thought of building a site profile, this module now makes it that much easier. 

    This week I've also been starting to focus on the next long term client project, which is kind of a different and unique one that I look forward to. That's in part because I expect it will also involve a lot of improvements to the ProcessWire core and ProFields modules as part of it. Some of my favorite ProcessWire improvements have accompanied projects like this. There just isn't any substitute for real-life, large-scale projects when it comes to improving and optimizing the core and modules. 

    Next week will be a shortened week here, so I'll likely post the usual weekly update Thursday rather than Friday. Thanks for reading and have a great weekend! 

    • Like 20
    • Thanks 2
  16. @joe_g It looks to me like you've got an autoload module that's injecting scripts into your admin (a cookie content module or SEO type module?). Such a module should only be injecting scripts into the front-end, and not into your admin. So I would identify what module is doing that and stop using it, or update it to only load on the front-end. It you can identify what module it is, let me know and I can suggest what to change about it. Likely it's just a change to 1 or 2 lines. 

    • Like 1
×
×
  • Create New...