Jump to content

Recommended Posts

On 1/28/2019 at 10:18 PM, kongondo said:

@besrwordt,

Do you have a current Media Manager subscription? makeBlankItem() is implemented in the latest Media Manager (version 012, soon coming out of beta). However, you can still import from one MM field to another. A MM field behaves like PageArrays (WireArrays).  

Yes i have. Will try that for sure!

A Media Manager field stores only two pieces of data; the (page) ID of the media being referenced and the media type (1=audio; 2=document; 3=image; 4=video; 3x=image variation). There's two ways you can go about exporting/importing from one field to the other. The second way is easiest if you need to import everything from one field to another, no questions asked. The first method allows fine control, e.g. if you want to skip certain media types. In the examples below, media_export is the Media Manager field with the media you want to copy over/merge with a second Media Manager field. media_import is the second Media Manager field into which media is being imported/copied over.

Method One: Loop through each media in the Media Manager field you are exporting from


// page with mm field we are importing into (media_import)
$p = $pages->get(1234);

// page with mm field we are exporting from (media_export)
foreach ($page->media_export as $m ) {
    // @note: here you can skip media you don't want to export
    // instance of new MediaManager()
    $mm = new MediaManager();
    // populate the MediaManager object properties with required data (media id and type)
    $mm->id = $m->id;
    $mm->type = $m->type;
    // import/add the media to the 2nd mm field (media_import)
    $p->media_import->add($mm);
}

// output formatting of
$p->of(false);
// save only the media manager field (page with import mm field)
$p->save('media_import');
// revert output formatting back on
$p->of(true);

 

Method Two: Import everything at once


// page with mm field we are importing into (media_import)
$p = $pages->get(1234);
// import all the media in the 1st mm field (media_export) into the 2nd mm field (media_import)
$p->media_import->import($page->media_export);
// output formatting of
$p->of(false);
// save only the media manager field (page with import mm field)
$p->save('media_import');
// revert output formatting back on
$p->of(true);

 

Note that all WireArray behaviour apply. For instance, you might want to first experiment in cases where your 2nd Media Manager field (media_import) already has some media which may or may not be present in the first Media Manager field. 

Great, Thanks!!!

 

Share this post


Link to post
Share on other sites

We've been experimenting with the v12 beta and have mostly had success with the new version.  We recently ran into a problem where the upload stopped working.  We can still upload via ftp and the "scan" function.  This is error that Tracy reports immediately after the files are uploaded.  We tried refreshing the module, but no go. 

MM-v12-error.png

Share this post


Link to post
Share on other sites
12 hours ago, Karinne Cyphers said:

We recently ran into a problem where the upload stopped working.  We can still upload via ftp and the "scan" function.  This is error that Tracy reports immediately after the files are uploaded.  We tried refreshing the module, but no go. 

Thanks for testing. The error says means that the media has not been found. It means that the media field is empty, for some reason, which is strange. The line where the error occurs tells me that in your settings you specify that uploading a duplicate media should replace the one that already exists in the Media Manager Library. Using these settings, I have tried to replicate the error that you are getting but everything works fine. The old media is replaced fine. Could you please provide more details? 

  1. What sort of media are you getting the error with? E.g. images
  2. If images, are they huge images?
  3. ProcessWire + PHP Versions
  4. What upload mode are you using? I've tried with both 'upload anywhere' on and off and I get no errors.
  5. It could be that you had an unfinished upload (maybe PHP ran out of memory). Could this be the case?

I have modified the file where the error is occurring to at least suppress the error. I've emailed it to you.

Share this post


Link to post
Share on other sites

Yes, what is strange is that the upload functionality was working fine, then it stopped working and began throwing those two errors.  Here are the details:

  1. Some media is a couple of megapixels, but the majority are things like icons and small graphics that are under 100kb, mostly imagees
  2. Most of the images are under 1mb and most are under 100kb
  3. Processwire 3.0.123 and PHP 7.3.x running as FPM
  4. We have upload anywhere turned on, but most of the uploads are done via the Media Manager itself
  5. The servers are virtualized but we have 256mb dedicated to PHP

We'll try to use the file you sent to see if suppressing helps the error.

Share this post


Link to post
Share on other sites
10 hours ago, Karinne Cyphers said:

Yes, what is strange is that the upload functionality was working fine, then it stopped working and began throwing those two errors. 

My bet is that there's an upload that didn't get completed and/or a media that, for some reason, did not get deleted and the process is stuck in memory.  Is it possible to try the following for me please?

  1. If you change the setting for "replacing duplicate media", to either "skip" or "rename" the uploaded media, does normal uploading work?
  2. With the setting back to "replace duplicate media", are you able to narrow down what particular image(s) leads to the errors? For instance, the error always occurs when you try to "upload and replace" a media called "Cats". We can then visit the "Cats" media page to edit it and see if there are any errors there.
  3. Are you able to edit your media pages to confirm that they all have images (i.e. they are not empty)?
  4. Are the images JPGs or PNGs or both?

Share this post


Link to post
Share on other sites

Well, it's strange... we toggled the replace duplicate media and gave it a go and now it is working again.  I set it back to confirm overwrite and it is still working.  This may be related to some other server issues we've been having, but our server guy has been making some adjustments to the environments today as well so that may have also had an impact.  Thank for your help with this!

Share this post


Link to post
Share on other sites

One other quick question, is there a configurable option to change the number of items returned?  I think by default it is set to 30, but is there an easy place we can change that?  Our content team has started to give us feedback and this was at the top of their list.

Share this post


Link to post
Share on other sites
9 hours ago, Karinne Cyphers said:

Thank for your help with this!

Glad you got it sorted :-).

 

9 hours ago, Karinne Cyphers said:

One other quick question, is there a configurable option to change the number of items returned?  I think by default it is set to 30, but is there an easy place we can change that?  Our content team has started to give us feedback and this was at the top of their list.

Yes. You can change the limit and lots of other similar stuff by using the filters under "What media to show". You can also configure and save a filter to be used as the default. Results can be filtered by a single or multiple criteria such as limit, title, description, tags, published, modified, etc. You can use operators such as contains text, equals, etc. The results are automatically refreshed when a filter is applied. Please see the two examples below. The first involves filtering the results directly without creating and saving the filter, although the filter will be cached and applied until the cache expires. The second one shows you how to create and save a filter that you can subsequently set as your default filter. This is especially useful if you are working in teams that need results tailored to their workflow. Please note that you may at times need to reset (rather than refresh) filters for a new one to apply due to caching. Although you can clear this type of filter directly, subsequent reloads with reload the filter as well. Hence, this type of filter persists across sessions. In the "What media to show" panel, the reset icon is the second one after the filters tab. The first icon is for refresh.

Direct Filter

 

media-manager-limit.thumb.gif.0ebf863d0f28b4a60f1a0ae5c6d7bb44.gif

 

Configure, Save and Apply Filter

In this example, we classify a number of items using a common tag, 'people'. We then create a filter titled People which limits the results returned by number (2) and tag (people). Please note that you do not have to use tags if all you are interested in is limit. We only use it to enrich the example. Finally, we set People as the default filter.  As a by  the way, you can also use tags to filter items in the frontend using a ProcessWire selector 🙂

media-manager-limit-filter.thumb.gif.aa2921d3ce8f713c151e30c3ce49c4a2.gif

  • Like 1

Share this post


Link to post
Share on other sites

Hi @kongondo,

we've discovered a strange behaviour of Media Manager upload (v 011): If the file extension is uppercase, i.e. "JPG", then the upload fails, despite "jpg" is set as valid image extension in settings. We've tried to add "JPG" (in uppercase) to the valid image extensions, but with no luck. The solution was finally to bulk rename all the files to lowercase jpg extension on a local device.

Have you ever heart of this beaviour? From my programmers view, I would assume, that the file extension check is case insensitive, but it isn't?

Greetings,

Thomas.

Share this post


Link to post
Share on other sites

HI @xportde

 

24 minutes ago, xportde said:

we've discovered a strange behaviour of Media Manager upload (v 011): If the file extension is uppercase, i.e. "JPG", then the upload fails, despite "jpg" is set as valid image extension in settings. We've tried to add "JPG" (in uppercase) to the valid image extensions, but with no luck. The solution was finally to bulk rename all the files to lowercase jpg extension on a local device.

Have you ever heart of this beaviour?

I'm not sure what's going on in your install :-). I've never experienced this behaviour before nor have I ever received a report about it. Just to be double sure, I've just now tested (MM 011; JFU 006) with an image with a .JPG extension and it is uploaded just fine. Any error shown? 

Share this post


Link to post
Share on other sites

Hi @kongondo,

this is very curious, indeed! So, if you never heart of this before, and it not seems to be a general problem, we will ask our customer not to use uppercased file extensions.

Thank you for your clarification!

Greetings,

Thomas.

Share this post


Link to post
Share on other sites
4 minutes ago, xportde said:

So, if you never heart of this before, and it not seems to be a general problem, we will ask our customer not to use uppercased file extensions.

What's their server environment? Are they on Windows? 

Edited by kongondo

Share this post


Link to post
Share on other sites

Hi @kongondo,

we've tested your new MM 012, great work!

In grid view, there is a small bug in rendering thumbnails: If the calculated width is not a whole number, the style of the elements div.mm_page_thumb is written as "width: 263,5px" for example. Because browsers expect decimal numbers in CSS with a dot, they fail in case of the comma, so the width is undefined and the thumbnail is not shown (see screenshot).

This error probably only occurs in german environments, where the decimal point is the comma by default.

I've changed line 524 in MediaManagerRenderer.php, what fixed the problem:

$wrapperWidth =  str_replace(',', '.', $media->thumbWidth) . 'px';

Alternatively, rounding the thumb width will have the same effect, because the decimal part isn't really important on rendering.

Greetings,

Thomas.

Screenshot MM 012 Grid View.jpg

  • Like 2

Share this post


Link to post
Share on other sites
On 5/8/2019 at 2:38 PM, xportde said:

In grid view, there is a small bug in rendering thumbnails: If the calculated width is not a whole number, the style of the elements div.mm_page_thumb is written as "width: 263,5px" for example. Because browsers expect decimal numbers in CSS with a dot, they fail in case of the comma, so the width is undefined and the thumbnail is not shown (see screenshot).

This error probably only occurs in german environments, where the decimal point is the comma by default.

Excellent find! You've saved me some debugging headache, thanks :-). A user reported missing images in grid view (table view was fine) and I couldn't figure out what was going on (I didn't have access to that site) but it was also a German user :-). 

Fixed in the release version (012). Please see post below.

Edited by kongondo

Share this post


Link to post
Share on other sites

Media Manager version 012  (released 10/05/2019)

Happy to announce the latest release of Media Manager.

Changelog

  1. ProcessWire 3.x support only.
  2. New GUI to match AdminThemeUiKit
  3. Upload Anywhere (drag and drop to upload in Media Manager Library and Media Manager Inputfields).
  4. Custom fields/columns - add any field to any of the Media Manager templates and access them as a property of a MediaManager object.
  5. Edit a single media including its custom fields

I would like to thank all the beta testers!

Documentation

Documentation is now complete! Please report any missing links or anything that is not clear.

Upgrading

  1. Grab the latest version of JqueryFileUpload (version 008) from here. Upgrade to that version (note: it is also namespaced)
  2. Grab the latest version of Media Manager using resend download links form here. Simply overwrite existing files but delete the files MediaManagerTabs.php and pocketgrid.css in the old files. Hit module refresh.

You might need to clear compiled files several times.

For most beta testers, upgrading has gone smoothly. However, two people have reported an error about class ProcessMediaManager not found in line 20 of MediaManagerUtilities. I have not been able to resolve this issue. I suspect FileCompiler is trying to be clever or some module loading order change?

Please let me know how it goes.

Beta testers, please upgrade as well. A few things have changed including a fix for the bug reported in the previous post.

Screenshots

media-manager.thumb.jpg.5b8aa9d4cc13f0638f5eb2d1c9f74f5c.jpg

Please refer to the documentation for more photos.

Thanks!

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

Hi @kongondo,

For one of our customers, some pages of the MediaManager image view are not shown, because they contain some too big original images. Referring to this, in error protocol is written the well-known "Allowed memory size of .. bytes exhausted"-message, but we can't find out, what specific image is causing this.

Have you any idea to identify the problematic images?

Best regards,

Thomas.

Share this post


Link to post
Share on other sites
23 hours ago, xportde said:

For one of our customers, some pages of the MediaManager image view are not shown, because they contain some too big original images. Referring to this, in error protocol is written the well-known "Allowed memory size of .. bytes exhausted"-message, but we can't find out, what specific image is causing this.

Oh, oh. Someone forgot to set limits to upload sizes and/or client-side image resizing 😬😀.

23 hours ago, xportde said:

Have you any idea to identify the problematic images?

Good question. I'm not sure whether the code below will work. I don't know whether such images are counted by ProcessWire as uploaded or it is just their resizing that is an issue. I don't have a test image to use but try the below please in a Tracy console and let me know. It is just checking for empties. If it doesn't work maybe we can search by image size (0x260) instead.

$empties = $pages->find("template=media-manager-image,media_manager_image.count=0");
d($empties,'EMPTIES');

 

Share this post


Link to post
Share on other sites

I hope you don't mind me giving a little constructive feedback, it's going to be a bit critical but it's just an aspect that I think is being overlooked in an otherwise excellent module.

I think one thing that is holding me back from embracing this media manager (actually, we bought this in the past and then never used it -- and this is because there's no demo available) is that it really needs a little love in the styling department.

Nothing fancy, but -- if we look at the screenshot above we can see just general CSS issues, alignment of the filter label top right, checkbox and sort icons are too close to the sort options, a lot of negative space between the filters and the nav, image count is too big and not aligned with pagination opposite. The spacing also between the types of media along the top is also not right when compared to how the CMS typically spaces out horizontal navigation. This is just in one screenshot, but these issues persist throughout in various places, such as notifications, upload boxes etc.

Considering we have the UIKit CMS theme to base everything off, this kind of thing means that the media manager feels out of place in an otherwise quite neatly organised CMS.

Now, people using this media manager for their personal projects will not care about these things, they will roll their eyes and say "why should we care, it's the back-end of the site, only functionality matters" (and in this, I must reiterate, you have done an outstanding job), however if I am building a CMS and handing it over to someone else, I need all aspects to have a consistency in quality because that is reassuring to clients.

  • Like 2

Share this post


Link to post
Share on other sites
24 minutes ago, cjx2240 said:

I hope you don't mind me giving a little constructive feedback

Not at all :-). Thanks for the feedback. I value such feedback.

24 minutes ago, cjx2240 said:

and this is because there's no demo available

Actually there is/was...but it is outdated. I can look into this. Meanwhile, one can always test and request a refund if they are not satisfied with the product :-). 

24 minutes ago, cjx2240 said:

Now, people using this media manager for their personal projects will not care about these things, they will roll their eyes and say "why should we care, it's the back-end of the site, only functionality matters" (and in this, I must reiterate, you have done an outstanding job), however if I am building a CMS and handing it over to someone else, I need all aspects to have a consistency in quality because that is reassuring to clients.

Agreed. The thing that confuses me though is that we have hundreds of people using Media Manager, for client projects, some quite big (working with Hollywood; +500K images, etc) but not a single person has ever mentioned design issues. I am not saying this translates to no issues but a I am a bit curious why no one else has raised such issues.

Thanks.

Share this post


Link to post
Share on other sites
39 minutes ago, kongondo said:

Agreed. The thing that confuses me though is that we have hundreds of people using Media Manager, for client projects, some quite big (working with Hollywood; +500K images, etc) but not a single person has ever mentioned design issues. I am not saying this translates to no issues but a I am a bit curious why no one else has raised such issues.

I can only speak for myself. But I feel the same way. I bought the Media Manager, but never used it. Once I used it in a customer project, I had feedback from the customers that the visualization and usability was not good for them. Personally, I'm also a little bothered by that. Why have I never submitted this as a suggestion for improvement? You know: laziness. I always had the hope that others would do it and that there would be an update at some point. 😄 

  • Like 2

Share this post


Link to post
Share on other sites
7 minutes ago, David Karich said:

Once I used it in a customer project, I had feedback from the customers that the visualization and usability was not good for them.

Thanks for the feedback. Was this an older version or the latest (012)?

Share this post


Link to post
Share on other sites
4 minutes ago, kongondo said:

Thanks for the feedback. Was this an older version or the latest (012)?

To be fair, the last version I worked with is 011. Of course there have been some changes with the new version, but optically I see some deficits as well. Apropos: I never received a download link for the update to 012 by mail. Or do I have to buy a new license?

Share this post


Link to post
Share on other sites
13 minutes ago, kongondo said:

Thanks for the feedback. Was this an older version or the latest (012)?

I can also tell you what bothered her the most, besides the visual component. My customers like to think in folders. They would like to click through a tree and categorize the data into folders. As PW itself is structured. Because the biggest problem here again is laziness itself. If you upload a picture and don't immediately describe and tag it properly, later searching becomes difficult. And my customers are all hectic and have no time for that. 😄 

Share this post


Link to post
Share on other sites
1 hour ago, kongondo said:

Agreed. The thing that confuses me though is that we have hundreds of people using Media Manager, for client projects, some quite big (working with Hollywood; +500K images, etc) but not a single person has ever mentioned design issues.

@kongondo Good to know (+500k), do they use $config->pagefileExtendedPaths, an unlimited file system or are there special features of the Media Manager for storing the images?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By robert
      I often had the need for an overview of all used fields and their contents for a specific page/template while developing new websites without switching to the backend, so I made a small module which lists all the needed information in a readable manner (at least for me):
      Debug Page Fields
      https://github.com/robertweiss/ProcessDebugPageFields
      It adds two new properties to all pages:
      $page->debugFieldValues – returns an object with all (sub-)fields, their labels, fieldtypes and values $page->debugFieldTypes – returns an object with all fieldtypes and their corresponding fields // List all values of a pages $page->debugFieldValues // List a specific field $page->debugFieldValues->fieldname // List all used fieldtypes of a page $page->debugFieldTypes I recommend using it in combination with Tracy Debugger, Ray, Xdebug etc. as it returns an object and is only meant for developing/debugging uses. 
      For now, the fieldtype support includes mostly fieldtypes I use in my projects, but can easily be extended by adding a new FieldtypeFIELDNAME method to the module. I use it with five different client installations (all PW 3.0.*), but of course there might be some (or more) field configurations which are not covered correctly yet.
      Supported fieldtypes
      Button Checkbox Color Combo Datetime Email FieldsetPage * File FontIconPicker Functional Image ImageReference MapMarker Multiplier Mystique Options Page PageIDs PageTitle Radio Repeater * RepeaterMatrix * RockAwesome SeoMaestro Table Text Textarea Textareas Toggle URL * The fields with complete subfield-support also list their corresponding subfields.
      Installation
      Download the zip file at Github or clone the repo into your site/modules directory. If you downloaded the zip file, extract it in your sites/modules directory. In your admin, go to Modules > Refresh, then Modules > New, then click on the Install button for this module. As this is my first ›public‹ module, I hope I did not miss any important things to mention here.
    • By horst
      Wire Mail SMTP

      An extension to the (new) WireMail base class that uses SMTP-transport

      This module integrates EmailMessage, SMTP and SASL php-libraries from Manuel Lemos into ProcessWire. I use this continously evolved libraries for about 10 years now and there was never a reason or occasion not to do so. I use it nearly every day in my office for automated composing and sending personalized messages with attachments, requests for Disposition Notifications, etc. Also I have used it for sending personalized Bulkmails many times.

      The WireMailSmtp module extends the new email-related WireMail base class introduced in ProcessWire 2.4.1 (while this writing, the dev-branch only).
       
      Here are Ryans announcement.



      Current Version 0.6.0
      Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md
      get it from the Modules Directory Install and Configure

      Download the module into your site/modules/ directory and install it.

      In the config page you fill in settings for the SMTP server and optionaly the (default) sender, like email address, name and signature.
      You can test the smtp settings directly there. If it says "SUCCESS! SMTP settings appear to work correctly." you are ready to start using it in templates, modules or bootstrap scripts.


      Usage Examples
      The simplest way to use it:
      $numSent = wireMail($to, $from, $subject, $textBody); $numSent = wireMail($to, '', $subject, $textBody); // or with a default sender emailaddress on config page This will send a plain text message to each recipient.
       
      You may also use the object oriented style:
      $mail = wireMail(); // calling an empty wireMail() returns a wireMail object $mail->to($toEmail, $toName); $mail->from = $yourEmailaddress; // if you don't have set a default sender in config // or if you want to override that $mail->subject($subject); $mail->body($textBody); $numSent = $mail->send(); Or chained, like everywhere in ProcessWire:
      $mail = wireMail(); $numSent = $mail->to($toEmail)->subject($subject)->body($textBody)->send(); Additionaly to the basics there are more options available with WireMailSmtp. The main difference compared to the WireMail BaseClass is the sendSingle option. With it you can set only one To-Recipient but additional CC-Recipients.
      $mail = wireMail(); $mail->sendSingle(true)->to($toEmail, $toName)->cc(array('person1@example.com', 'person2@example.com', 'person3@example.com')); $numSent = $mail->subject($subject)->body($textBody)->send(); The same as function call with options array:
      $options = array( 'sendSingle' => true, 'cc' => array('person1@example.com', 'person2@example.com', 'person3@example.com') ); $numSent = wireMail($to, '', $subject, $textBody, $options); There are methods to your disposal to check if you have the right WireMail-Class and if the SMTP-settings are working:
      $mail = wireMail(); if($mail->className != 'WireMailSmtp') { // Uups, wrong WireMail-Class: do something to inform the user and quit echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; return; } if(!$mail->testConnection()) { // Connection not working: echo "<p>Couldn't connect to the SMTP server. Please check the {$mail->className} modules config settings!</p>"; return; }  
      A MORE ADVANCED DEBUG METHOD!
      You can add some debug code into a template file and call a page with it:
      $to = array('me@example.com'); $subject = 'Wiremail-SMTP Test ' . date('H:i:s') . ' äöü ÄÖÜ ß'; $mail = wireMail(); if($mail->className != 'WireMailSmtp') { echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; } else { $mail->from = '--INSERT YOUR SENDER ADDRESS HERE --'; // <--- !!!! $mail->to($to); $mail->subject($subject); $mail->sendSingle(true); $mail->body("Titel\n\ntext text TEXT text text\n"); $mail->bodyHTML("<h1>Titel</h1><p>text text <strong>TEXT</strong> text text</p>"); $dump = $mail->debugSend(1); } So, in short, instead of using $mail->send(), use $mail->debugSend(1) to get output on a frontend testpage.
      The output is PRE formatted and contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection, like this one:
       
      Following are a ...


      List of all options and features


      testConnection () - returns true on success, false on failures


      sendSingle ( true | false ) - default is false

      sendBulk ( true | false ) - default is false, Set this to true if you have lots of recipients (50+)


      to ($recipients) - one emailaddress or array with multiple emailaddresses

      cc ($recipients) - only available with mode sendSingle, one emailaddress or array with multiple emailaddresses

      bcc ($recipients) - one emailaddress or array with multiple emailaddresses

       
      from = 'person@example.com' - emailaddress, can be set in module config (called Sender Emailaddress) but it can be overwritten here

      fromName = 'Name Surname' - optional, can be set in module config (called Sender Name) but it can be overwritten here


      priority (3) - 1 = Highest | 2 = High | 3 = Normal | 4 = Low | 5 = Lowest

      dispositionNotification () or notification () - request a Disposition Notification


      subject ($subject) - subject of the message

      body ($textBody) - use this one alone to create and send plainText emailmessages

      bodyHTML ($htmlBody) - use this to create a Multipart Alternative Emailmessage (containing a HTML-Part and a Plaintext-Part as fallback)

      addSignature ( true | false ) - the default-behave is selectable in config screen, this can be overridden here
      (only available if a signature is defined in the config screen)

      attachment ($filename, $alternativeBasename = "") - add attachment file, optionally alternative basename


      send () - send the message(s) and return number of successful sent messages


      debugSend(1) - returns and / or outputs a (pre formatted) dump that contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection. (See above the example code under ADVANCED DEBUG METHOD for further instructions!)


      getResult () - returns a dump (array) with all recipients (to, cc, bcc) and settings you have selected with the message, the message subject and body, and lists of successfull addresses and failed addresses,


      logActivity ($logmessage) - you may log success if you want

      logError ($logmessage) - you may log warnings, too. - Errors are logged automaticaly
       
       
      useSentLog (true | false) - intended for usage with e.g. third party newsletter modules - tells the send() method to make usage of the sentLog-methods - the following three sentLog methods are hookable, e.g. if you don't want log into files you may provide your own storage, or add additional functionality here

      sentLogReset ()  - starts a new LogSession - Best usage would be interactively once when setting up a new Newsletter

      sentLogGet ()  - is called automaticly within the send() method - returns an array containing all previously used emailaddresses

      sentLogAdd ($emailaddress)  - is called automaticly within the send() method
      Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md
       
       
    • By Cybermano
      Food Allergens Module
      A simple List of Food Allergens
      My needs were to provide a simple list of food allergens for our clients with restaurant related activity.
      The idea was to simply output the list (to speed up the data entry) without leaving the food menu editing, eg. opening another page in new tab or window.
      This isn't a perfect solution, but it works fine for my needs and I decided to share the base idea.
      This could also be easily used to show little notes or short "vademecum", not only for the list of food allergens.
      ---
      Main features
      The basis
      All moves from a short editing of the module in this tutorial: How to create custom admin pages by @bernhard
      First of all it creates an empty admin page, with a dedicated permission to let safe-user to see it (this permission has to be created as a new ones, manually or by the module).
      Once the page is created, I have hooked its behaviour into the ready.php, to show the content (basically a list).
      A step further
      With the tips of  @bernhard, @Soma (and many others), see here , the magic happens. 
      The new page will be shown as a panel, so editors will not abandon their data entry to have a quick view to the list.
      A little further
      Why scroll to the top of the page to click a link?
      The next step was to create a sticky button only in the food menu pages.
      Again with a @bernhard tip I moved into the customization of this simple module and the related hook.
      ---
      How to use this module
      After installed, it creates the page /admin/page/allergens/ and the module is to be setted up. The first field is a CKEditor with multi-language. This is the place where to write the informations that will be shown into the page. The next field is a simply text-area where to place a bit of JS that will be appended to the markup of the text (omit the 'script' tags). I also putted a checkbox with a silly statement: this to think at least twice on the safety of the written JS. Now comes the first way to display the link to the page
      Field Note with Link. Enable and save it. The module will display a new row with 4 selects (1 standard and 3 ASM):
      View mode (to show the page as Panel or as Modal PopUp); Templates to select: select one or more and save before proceed, so the  asm-select of the pages will be populated showing all the pages of the selected templates. Pages to select: also here select at least one and save before proceed to populate the asm-select for fields only with the ones that belong to the selected pages. Select the fields where to place the note and save again. That's all: now you will find into the notes of the selected fields the link "See the List of Allergens".
      At the same way, the option for the sticky button, but with a plus
      The field select is obviously unnecessary, but you could play with the last row: the inline styles to fix your sticky button where you like. Here you could set the sticky position of the <div> and the absolute ones of the <a>.

      Video Explanation
      In these screencasts you could see a custom JS that show a "copy" button near a "hanna-code" call.
      This because I've set a specific one for each allergen to show up a tooltip in the front end.

      Registrazione #33.mp4  

      Registrazione #34.mp4 ---
      Last but not the least
      Actually it works fine for my needs, even if it's much improvable: I'm working on the permissions creation, the uninstall section, a separate configs and defaults and how to include the hook into the module leaving free the ready.php. According to a simpler uninstall. Also I would make the link text as a dynamic text field, so it will be more flexible.
      I always learn a lot here, so I would share my code for whom it could be interested.
      I removed the hanna code references, but I provide you the html list of the allergens, English and Italian too, so you can paste them into the "source" of the CKEditor field to have a ready to use module.
      Obviously you are free to modify the code as per your needs.
      Please, keep in mind that I'm not a pro coder and I beg your pardon for my verbosity (speaking and coding). 😉
      I hope be helpful or for inspiration.
      Bye
      ready.phpList-ITA.htmlList-ENG.htmlAllergens.module
      README.md
    • By Robin S
      This module is sort of an upgrade to my earlier ImageToMarkdown module, and might be useful to anyone working with Markdown in ProcessWire.
      Copy Markdown
      Adds icons to images and files that allow you to copy a Markdown string to the clipboard. When you click the icon a message at the top left of the screen notifies you that the copying has occurred.
      Screencast

      Note: in the screencast an EasyMDE inputfield is used to preview the Markdown. It's not required to use EasyMDE - an ordinary textarea field could be used.
      Usage: Images
      When you hover on an item in an Images field an asterisk icon appears on the thumbnail. Click the icon to copy an image Markdown string to clipboard. If the "Description" field is populated it is used as the alt text.
      You can also open the "Variations" modal for an image and click the asterisk icon to copy an image Markdown string for an individual variation.
      Usage: Files
      When you hover on an item in a Files field an asterisk icon appears next to the filename. Click the icon to copy a link Markdown string to the clipboard. If the "Description" field is populated it is used as the link text, otherwise the filename is used.
       
      https://github.com/Toutouwai/CopyMarkdown
      https://processwire.com/modules/copy-markdown/
    • By BitPoet
      I've realized that I've been jumping back and forth between the PW API docs and the source code for site modules far too much. The idea to hold all necessary documentation locally in one place has occurred to me before, but getting PHPDocumentor et al set up and running reliably (and producing readable output) as always been too much of a hassle. Today I was asked how I find the right hooks and their arguments, and that inspired me to finally get my backside down on the chair and whip something up, namely the
      Module Api Doc Viewer
      ProcessModuleApiDoc
      It lets you browse the inline documentation and public (optionally also protected) class/method/property information for all modules, core classes and template files in the ProcessWire instance. The documentation is generated on the fly, so you don't have to remember to update your docs whenever you update a module.
      The module is quite fresh, so expect some bugs there. Behind the scenes it uses PHP-Parser together with a custom class that extracts the information I needed, and the core TextformatterMarkdownExtra module for rendering the description part in the phpdoc style comments.
      This is not a replacement / competitor to the API Viewer included in the commercial ProDevTools package. There is quite some information included in the inline documentation that my module can't (and won't) parse, but which makes up parts of the official ProcessWire API docs.
      This, instead, is a kind of Swiss army knife to view PHPDoc style information and get a quick class or function reference.
      If you feel daring and want to give it a spin, or if you just want to read a bit more, visit the module's GitHub repository.
      This is the overview page under "Setup" -> "Module API Docs":

      And this is what the documentation for an individual class looks like:

      The core module documentation can of course be found online, but it didn't make sense not to include them.
      Let me know what you think!

×
×
  • Create New...