Jump to content

thausmann

Members
  • Posts

    26
  • Joined

  • Last visited

Posts posted by thausmann

  1. Dear ProcessWire community,
    Over the last years I created many small–medium websites for classic musicians among other things. I have grown to a point where I cannot support all projects in a timely manner, so I look for some support on code level. (Some websites are oldschool PHP templates, some are headless with a Svelte or Next.js frontend.)

    Tasks may involved

    • Implementing new screens and features (designs provided by me)
    • Refactoring oldish static fields to more flexible repeater layout
    • Maintenance (Updating ProcessWire, PHP Versions)

    Requirements

    • Experience with ProcessWire, HTML, Vanilla JS, jQuery, CSS, Sass, node.js build tools, Git, SFTP
    • Ability to estimate tasks, plan and deliver on time
    • Billed by the hour based on estimates

    Nice to have, but not required

    • Experience with custom ProcessWire Modules, Docker, Svelte, React, Next.js, Typescript, THREE.js, R3F, GDPR complience
    • Eye for design details
    • Germany based / German speaking

    Please send me a DM if you are interested so we can discuss details.

    • Like 2
  2. @ZAP hmm that's weird, can you search for MinifyPageRender in your project and see if it comes up twice, maybe delete the cache?

    Searching the forum for this yields some older reports of similar errors, but no definite solution.

  3. @Ralf alright I'm on it. The new approach is a WireArray events property, that can hold data for one or more events. 

    // get the module
    $icsgen = wire()->modules->IcsGenerator;
    
    // add an event
    $icsgen->events->add([
        'summary' => 'Event Title 1',
        'description' => 'Event body 1',
        'dtstart' =>'2033-12-24 12:00',
        'dtend' => '2033-12-24 14:00',
    ]);

    This is a breaking change, rest of the API stays the same.

    Here is a working prototype so you can already test it if you like. I aim for a new version that also supports most ICS event properties like last-modified etc.

    Edit: should be mostly done, just have to add some docs. Maybe someone can test it in Outlook.

    • Like 1
  4. The module isn't working for me aswell. I did some debugging and the issue seems to be having a <header> element in the HTML anywhere before an email address.

    This issue was mentioned earlier and allegedly fixed, but the problem I'm facing is gone when changing my <header> to a <div>.

    This obfuscate method should probably skip replacing addresses in the <head>, but cannot distinguish it from <header>. 
    Adding a negative lookahead to the <head regex seems to fixes this issue. Here is a Git diff that's working for me. [Pull Request]

    Edit: just a conceptional thought, to support obfuscation everywhere, I could imagine a regex matching any email address in the entire HTML, and collect obfuscated attributes in a custom attribute, something like data-emo="title,value,innerHTML".

  5. Hey @jploch,

    oh yes, getFile() only creates temporary files, they are deleted automatically when ProcessWire is done with the request. That may sounds weird, but my use case was to send ICS via E-Mail. 

    To permanently store the file somewhere, I could imagine something like this:

    // write ICS to a custom file
    // https://processwire.com/api/ref/wire-file-tools/file-put-contents/
    $str = $icsgen->getString();
    $files->filePutContents('/my/server/path/event.ics', $str);

    or

    // add the temporary file to a file field (field named "ics_files")
    // https://processwire.com/talk/topic/15928-adding-a-file-to-pagefiles-and-saving-to-database/
    $path = $icsgen->getFile();
    $page->of(false);
    $page->ics_files->add($path);
    $page->save('ics_files');

    Both untested, let me know if this works.

    • Like 2
  6. The module can generate basic ICS calendar strings and files.

    Usage Example:

    $icsgen = wire()->modules->IcsGenerator;
    
    // set properties
    $icsgen->setArray(array(
      'date' => new \DateTime('2033-12-24 12:00'),
      'dateEnd' => new \DateTime('2033-12-24 13:00'),
      'summary' => 'Event title',
      'description' => 'Event description',
    ));
    
    // get path to a temporary .ics file
    // (using wire()->files->tempDir)
    $icspath = $icsgen->getFile();
    
    // send email with ics file
    $mail = wireMail();
    $mail->attachment($icspath, 'calendar.ics');
    $mail->to($user->email);
    $mail->subject('ICS Demo');
    $mail->body('This is a ICS demo.');
    $numSent = $mail->send();

    For more infos see GitHub Readme or Modules Page. If you experience reproducable issues please open a GitHub issue.

    • Like 17
    • Thanks 2
  7. Hello, I'm wondering if there is way to use $cache so it lasts exactly for one request, something like WireCache::expiresRequest?

    Edit: I didn't think right, I can simply delete the cache when I'm done. And cache is probably overkill, in memory should be fine.

    I wrote a cron php script that bootstraps ProcessWire and sends out some e-mails with an ICS file attached. 
    I thought about caching the different files (the filepath to be precise) instead of generating the same over and over again. 

  8. Hey @adrian,

    thanks a lot, I've tested your modified version. For me, subfields as top level options are totally fine, already adds a lot of possibilites for user references!

    Quote

    when exporting a table with a page reference field, it should export the title of the selected page(s), and not the ID

    I found that my columns have type pageAutocomplete and not pageSelect, I think that's why they were exported as IDs only. I added pageAutocomplete to the fieldType checks and this works! – unless I export both "User" and "User.email", then somehow the $subfields indexes are off (Undefined offset ...). So I made one more change where the main page "User" is not added as an option anymore. To cover all cases I also added id as a subfield option. I marked my edits with //@TH SUBFIELDS

    There is also pageAutocompleteMultiple, that seems to procude other problems I didn't dig into.

     

    TableCsvImportExportSubfieldsTH.zip

    • Like 1
  9. @horst thanks, we still need the session / active login somehow but maybe this is a starting point. 

    @LostKobrakai thanks for the link, the Storage Access API looks very promising (requesting user permissions) and matches our use case (user is already signed in in the main window). Apparently this has no Chrome Support (yet). For the OAuth Solution I need more time to understand it ?

    Will post updates here if I find a solution!

    • Like 1
  10. Hi all, 

    is there an easy way to implement login and session handling that doesn't require cookies? I'm thinking about passing the session ID as a URL parameter instead of a cookie (like good old PHPSESSID) but I cannot get it working. I can easily append the URL parameter, but I cannot "restore" the session on the server. Do you think it's possible or is the cookie behaviour hardcoded in Session.php?

    Background: Browsers are working towards more privacy protection and banning "3rd party cookies". While this primarily targets tracking services, it applies to all sites embedded as an iframe. We are using Processwire like an iframe "Applet" for other websites and we start seeing problems (user logins reset) due to the new privacy policies. Safari has already implemented this, Chrome has scheduled this as a standard for 2022 but already has a privacy setting for this feature.

  11. Hey, I just refactored my site to use markup regions and noticed slower responses / rendering times by two-four times.

    I'm having a landingpage with a Pagetable that has 15 blocks, most of them have a little CSS with mediaqueries that I can now put in the header with pw-append, which is nice, but seems especially costly to do it 15 times. I put together a minimal example showing the speed impact: https://gist.github.com/timohausmann/e7643d75e26135450dab63e33c94de8f

    This effect scales up so my real page went from 600ms to 3.2s. The page gets cached in the end so it's not a total deal breaker, but I'm wondering if I'm doing something wrong, or if this is normal and markup regions and pw-append aren't designed to be used repeatedly?

    Thanks for reading!

  12. Hey, I'm trying to completely switch over to WebP and noticed some strange behaviour. Let's say I upload a PNG in Processwire of size 1280x800.

    • $page->image->url ➝ correct URL (filename.webp)
    • $page->image->width(800)->url ➝ correct URL (filename.800x0.webp)
    • $page->image->width(1280)->url wrong URL (filename.1280x0.png), webp file is not generated
    • $page->image->width(1280)->url(false)correct URL (filename.1280x0.webp) but webp file is not generated

    So: When I request a size that equals the original file, no WebP conversion is happening (no webp file is created, although a new PNG is generated (...1280x0.png)).
    When I use url(false), I get the expected URL but still the file is not generated. Also interesting: this issue is only occuring with PNG, not JPG.

     

    My Configuration:

    $config->imageSizerOptions('webpAdd', true); 
    $config->imageSizerOptions('defaultGamma', -1); 
    • GD
    • Pageimage::url Hook from here 
    • Also tried to output width(1280)->webp->url, it makes no difference
    • I checked that the PNG version is not smaller in filesize (PNG=450KB, WebP (from other tool)=60KB)
    • Tested with Processwire 3.0.148 and 3.0.160 dev
    • I think this post is about the same issue and where I got the url(false) from.
    • Setting 'useSrcUrlOnFail' => false inside $config->webpOptions results in correct output URL (filename.1280x0.webp), but still the file is not generated. So maybe the webp conversion fails? Apparently I see zero webp logs in logs/image-resizer.txt

     

    "Don't use resize" seems like a solution here but this is a generic approach in my code, sometimes uploaded images are simply already in the correct size. 

    Any ideas how to fix this and always get dem sweet sweet WebP images? Or did I find a bug?
    Maybe @horst has an idea what the cause of this phenomenon could be? ?

  13. For anyone like me who's slowly descending into madness wondering why their fields are ignoring the required validation: Make sure to set required=1 before setting the HTML5 required attribute. Otherwise the required flag will reset to 0. 

    Correct order:

    $field->required = 1;
    $field->attr('required', true);

    Using requiredAttr is more fool-safe, here the order does not matter (and it looks nicer):

    $field->required(true);
    $field->requiredAttr(true);

     

  14. On 5/23/2020 at 4:33 PM, hellomoto said:

    On the frontend template I have this in an edit form:

    
        $field = $modules->get("InputfieldCheckbox");
        $field->label = "Discard";
        $field->attr('id+name', 'prop_discard');
        if($page->discard == 1) $field->attr("checked");
        $proform->append($field);

    Because $field->value = $page->discard does not work, nor does anything else I've tried. How do I get the checkbox to reflect if it is checked? Right now on save if it was checked it needs to be re-checked every time.

    A bit late but hey: If you only pass one argument to attr it will retrieve the value. So to set / tick a checkbox try $field->attr("checked", 1). Note that even attr("checked", 0) will set the checked attribute, so simply do nothing to leave it un-checked.

    If discard is already an InputfieldCheckbox from your template, you can simply do 

    $field = $page->getInputfield('discard');

    and it will automatically come with the correct label, value and checked attr from the backend.

    To also make this work in a "create new" form (when there is no $page yet) you can also get fields via $fields and a NullPage: 

    $f = $fields->get('discard');
    $p = $do_we_already_have_a_page ? $page : new NullPage();
    $field = $f->getInputfield($p);

     

×
×
  • Create New...