Leaderboard
Popular Content
Showing content with the highest reputation on 06/01/2019 in all areas
-
Or you could just use a RuntimeMarkup field ? with WireHttp() and $cache. I'd never heard of SmugMug before ?. Here's a demo for how this could be done in RM. We are mimicking a ProcessWire image field by using similar markup and including Image field's JS and CSS. Please see the notes in the code. We are also caching the response for 1 hour so we don't hit SM limits. I created a free 14-day trial account for this. Here it is...I couldn't think of a better name for it ?. As you can see in the demo video, we are pulling the exact images. The code could be improved. You could get all fancy and even push changes to SM using Ajax, for instance. Please see the examples in RM docs. This code goes into the file you are rendering. <?php namespace ProcessWire; // set PW image assets $url = $config->urls->InputfieldImage; $config->styles->add($url . "InputfieldImage.css"); // @note: JS just in case you need it but in that case, you will also need Magnific, etc $config->scripts->add($url . "InputfieldImage.js"); // get cache only if it’s less than or equal to 1 hour old (3600 seconds) // @note: cache is unique for this page $cacheName = "smugmug_{$page->id}"; $images = $cache->get($cacheName, 3600); // no cache or expired, request data from smugmug if(is_null($images)) { // Get an instance of WireHttp $http = new WireHttp(); // we want JSON, so set headers accordingly $headers = array('Accept'=>'application/json'); $http->setHeaders($headers); // an example public album $url = 'https://www.smugmug.com/api/v2/album/xxxxxx!images'; $data = array('APIKey'=>'12345678900987654321');// API key $response = $http->getJSON($url, true, $data); $images = $response['Response']['AlbumImage']; // cache the response, and expire after 1 hour (3600 seconds) // @note: only caching the albmum! $cache->save($cacheName, $images, 3600); } // outer list markup for images (c & p from PW with slight modifications) $out = "<ul class='gridImages ui-helper-clearfix ui-sortable'>"; // iterate through response. // @todo: You might want to do some error checking first foreach($images as $image) { // file size to kB $fileSize = ceil($image['OriginalSize'] / 1000); $out .= " <li id='file_{$image['UploadKey']}' class='ImageOuter gridImage ui-widget'> <div class='gridImage__tooltip'> <table> <tbody> <tr> <th>Dimensions</th> <td>{$image['OriginalWidth']}x{$image['OriginalHeight']}</td> </tr> <tr> <th>Filesize</th> <td>{$fileSize} kB</td> </tr> <tr> <th>Description</th> <td><small>{$image['Title']}</small></td> </tr> </tbody> </table> </div> <div class='gridImage__overflow' style='width: 130px; height: 130px;'> <img src='{$image['ThumbnailUrl']}' alt='{$image['Caption']}' data-w='{{$image['OriginalWidth']}}}' data-h='{{$image['OriginalHeight']}}' data-original='' style='max-height: 100%; max-width: none; top: 50%; left: 50%; transform: translate3d(-50%, -50%, 0px);'> </div> <div class='gridImage__hover'> <div class='gridImage__inner'> <label for='' class='gridImage__trash'> <input class='gridImage__deletebox' type='checkbox' name='delete_images_{$image['UploadKey']}' value='1' title='Delete'> <span class='fa fa-trash-o'></span> </label> <a class='gridImage__edit' style='line-height: 130px;'> <span>Edit</span> </a> </div> </div> </li> "; } $out .= '</ul>'; $out = "<div id='my_album'>{$out}</div>"; return $out; Screenshot Video Demo8 points
-
This week we’ll take a look at 3 different WEBP image strategies that you can use in ProcessWire 3.0.132+. Then we’ll dive into a major update for the Google Client API module, and finish up by outlining some useful new updates in FormBuilder— https://processwire.com/blog/posts/webp-images-and-more/6 points
-
So many new features... so little time. ?6 points
-
I just submitted a pull request with fixes for the overflow positioning, offset when CKEditor is in inline mode, and overrides for the <ul> padding and margin coming from AdminThemeUikit. https://github.com/BitPoet/ProcessCKInlineComplete/pull/45 points
-
v0.2.1 released. This is a fairly major update in that there has been quite a bit of refactoring. Please be alert for and report any issues. ProcessWire >= v3.0.0 is now required. This release adds a new hookable HannaCodeDialog::buildForm() method that lets you build the dialog form in the hook rather than setting inputfield options as pseudo-attributes in the Hanna Code tag settings. From the readme... Build entire dialog form in a hook You can hook after HannaCodeDialog::buildForm to add inputfields to the dialog form. You can define options for the inputfields when you add them. Using a hook like this can be useful if you prefer to configure inputfield type/options/descriptions/notes in your IDE rather than as extra attributes in the Hanna tag settings. It's also useful if you want to use inputfield settings such as showIf. When you add the inputfields you must set both the name and the id of the inputfield to match the attribute name. You only need to set an inputfield value in the hook if you want to force the value - otherwise the current values from the tag are automatically applied. To use this hook you only have to define the essential attributes (the "fields" for the tag) in the Hanna Code settings and then all the other inputfield settings can be set in the hook. Example buildForm() hook The Hanna Code attributes defined for tag "meal" (a default value is defined for "vegetables"): vegetables=Carrot meat cooking_style comments The hook code in /site/ready.php: $wire->addHookAfter('HannaCodeDialog::buildForm', function(HookEvent $event) { // The Hanna tag that is being opened in the dialog $tag_name = $event->arguments(0); // Other arguments if you need them /* @var Page $edited_page */ $edited_page = $event->arguments(1); // The page open in Page Edit $current_attributes = $event->arguments(2); // The current attribute values $default_attributes = $event->arguments(3); // The default attribute values // The form rendered in the dialog /* @var InputfieldForm $form */ $form = $event->return; if($tag_name === 'meal') { $modules = $event->wire('modules'); /* @var InputfieldCheckboxes $f */ $f = $modules->InputfieldCheckboxes; $f->name = 'vegetables'; // Set name to match attribute $f->id = 'vegetables'; // Set id to match attribute $f->label = 'Vegetables'; $f->description = 'Please select some vegetables.'; $f->notes = "If you don't eat your vegetables you can't have any pudding."; $f->addOptions(['Carrot', 'Cabbage', 'Celery'], false); $form->add($f); /* @var InputfieldRadios $f */ $f = $modules->InputfieldRadios; $f->name = 'meat'; $f->id = 'meat'; $f->label = 'Meat'; $f->addOptions(['Pork', 'Beef', 'Chicken', 'Lamb'], false); $form->add($f); /* @var InputfieldSelect $f */ $f = $modules->InputfieldSelect; $f->name = 'cooking_style'; $f->id = 'cooking_style'; $f->label = 'How would you like it cooked?'; $f->addOptions(['Fried', 'Boiled', 'Baked'], false); $form->add($f); /* @var InputfieldText $f */ $f = $modules->InputfieldText; $f->name = 'comments'; $f->id = 'comments'; $f->label = 'Comments for the chef'; $f->showIf = 'cooking_style=Fried'; $form->add($f); } });4 points
-
@bernhard i have 3 custom CkInlineActions, 2 are for selecting pages from a central media library that stores images, video, audio, and embeds. The other selects musical works from a list of works (pages). The editors can insert a link to any work without having to use page list select; this is pretty much essential, as using the page list select to find a record among hundreds would be too time consuming. (1) Insert link to work, the user types @ and then the first characters of the title... (2) Insert a shortcode to display a video or image (uses Ui-kit lightbox); The shortcodes are processed by a custom textformatter that does the replacements. to insert a video the users type ~v and then the module just shows all of the videos; you don't need to type the title of the video, as the behavior of the module in terms of how it displays results is based on how you setup your CkInline action. To insert an image they type ~i. Example of the shortcode that is generated by the inline action:3 points
-
I just released version 0.7.0 of the module: It fixes the ugly label being showed above the "inhterit" checkbox for newer Processwire versions. I think there is a bug in core, because ProcessWire ignores the fact that the label is marked as "hidden". I had to fix it via CSS for now. Added the possibility to resize the Opengraph image when referencing a page image by specifying a width and/or height. Opengraph image: If the referenced image field is empty and pulls the image from another page (default value), the module now substitutes the default image as well. Other than that the readme now contains a chapter for the various hooks provided by SeoMaestro. This might be interesting if you need to customize the behaviour of the module. Please let me know if you find any issues! ? Cheers2 points
-
2 points
-
A more complex approach would be a new fieldtype which allow to browse and select through the SmugMug API. Edit: just found this, which may help to go that way: http://phpsmug.com/2 points
-
The most simple approach I can think of right now is hook into after InputfieldText::render: Put this code in site/ready.php: $wire->addHookAfter("InputfieldText::render", function($event){ $field = $event->object; if($field->name == "text_field_name" && $field->value){ $markup = $event->return; $url = "https://somedomain.com"; $markup .= "<img width='100' src='". $url . $field->value ."'>"; $event->return = $markup; } }); I'm assuming $url is whatever you need to append to complete the url with the ID in place. This should render the image right below the text input. If you want to dig a bit more, check the code in the link I pasted and debug with a $log->save() the $markup variable which basically gets it's content from the $event->return property which matches the return value of the render function in the Inpufield code.2 points
-
This is the topic for the new module, TextInputAwesomeplete. Github: https://github.com/outflux3/TextInputAwesomplete Modules Directory: https://modules.processwire.com/modules/text-input-awesomplete/ Text Input Awesomplete Key Points: Uses Awesomplete JS library for instantiating autocomplete suggestions on text input fields in Processwire CMS. Supports any text field, including Page Title (FieldtypePageTitle). Allows admins to configure a list of suggestions (textarea input), or pull suggestions from Processwire pages, by configuring which pages to pull from and which field's value to use. About Awesomplete https://leaverou.github.io/awesomplete/ https://github.com/LeaVerou/awesomplete Benefits & Uses Can be helpful for fields where users may need to enter the same text in the same field on multiple pages, and you can't or don't want to use a Page Reference field. One example could be a site where you send emails using various boilerplate subjects; Another place to use this would be if you had an existing site with a text field that has some inconsistency when same values are added. The autocomplete would help editors to always use the same format as the other pages with the same value. Installation Upload or install from Modules directory. Usage & Configuration Once installed, on any text input field (including Page Title), you will see an option to enable autocomplete. Once enabled you will have the option to type a list of items for autocomplete suggestions, or enable the module to search pages for suggestions. Note that if you enter any items in the Items List field, those will always be part of the autocomplete suggestions, in addition to pages if configured. If you elect to use pages for the suggestions, you have these options: Choose a template to limit by (adds a template=sometemplate to the pages find selector). Override which field to pull suggestions from (by default it will use the field you are configuring). Sets the $field!= in the selector. Setup a Selector for finding the pages for the autocomplete suggestions. This overrides the template selected. Note that the selector needs to return pages that use the field being configured, or the field selected for override. Screenshots: (1) Examples of in-use: Module Configuration Screen1 point
-
1 point
-
Thanks a lot for that! I‘m away for the weekend and can‘t test it thoroughly, but it looks fine so I merged it to the dev tree. Will give it a closer look and push to master Sunday evening.1 point
-
Just gave this module a try and it worked beautifully. Will definitely be using it in the future! One slight hiccup, though: after cloning the module from GitHub I couldn't find it anywhere in the modules list. Took me a while to realise that it was listed as "Text Autocomplete" instead of "Text Input Awesomplete". Might be something to consider in future releases ?1 point
-
I hope I didn't come across as shutting the door on the suggestions here :-). I was just pointing out a few realities. Like I said, I don't know much about marketing. It would be wise to listen to those who do :-). So, yes, I am still listening and by all means, let folks continue to chime in please.1 point
-
You've definitely got a point there, @Mikie. Getting the word out about Padloper is a goal worth striving for. While I don't think that Ryan should (or would, for that matter) include Pro-prefixed modules from other authors to the official shop, at least for the time being (it would cause a lot of confusion about the person responsible for said module), but getting the module included there isn't a bad idea overall. I think it would benefit ProcessWire as well to have an ecommerce module available via the official store, at least as an alternative way of purchasing. Perhaps that's something to consider in the future? ? Although renaming the module doesn't really seem necessary, words such as "eCommerce" and "shop" etc. definitely need to be mentioned in the context of Padloper. In fact they already are: current website states clearly what Padloper is, though from SEO point of view there are some additional steps that should be taken, and the site – particularly the home page – would benefit from some reorganising as well. Then again, I'm assuming that @kongondo might have a new site planned anyway ?1 point
-
1 point
-
Since I started this naming discussion I'll chime in. Agree with all the above @kongondo and @teppo, if you think if it as ecommerce for current ProcessWire devs then no worries - the name is unique and already ranks well, and changing things is more work and not something to be done lightly. My rationale for bringing this up was that ecommerce is such a competitive, active space, and the solutions are all so frustrating to work with as most here can probably attest, that I feel like this will definitely draw new devs to PW itself. My original chain of thought was this: although the Pro modules are by convention officially developed and supported by Ryan, something generic like ProShop or ProCommerce which was officially endorsed and listed in the Pro shop would make sense. Then the name also becomes about PW as well, eg Processwire ProCommerce, and it is very clear what the module does and what system it integrates with. Alternatively, I think it is worth considering wording around Padloper and Processwire, like eg. WooCommerce which is the "eCommerce platform for Wordpress". I feel like you could definitely get out there into ecommerce solution comparison lists and quadrant listings and all the constant chatter that goes on around this. The same "what is the best ecommerce platform" or "which is better, shopify or woocommerce" questions are posted on reddit almost weekly, it is more in this space that I am thinking about the use of the name.1 point
-
Thanks! I'll give it a try!1 point
-
That helps! It sounds like I need to get access to their Azure Active Directory and not their 365 account. Thanks!1 point
-
"Office 365 uses Azure Active Directory (Azure AD) to manage user identities behind the scenes. Your Office 365 subscription includes a free subscription to Azure AD so that you can integrate Office 365 with Azure AD if you want to sync passwords or set up single sign-on with your on-premises environment. You can also buy advanced features to better manage your accounts." https://docs.microsoft.com/en-us/office365/enterprise/azure-integration I've never actually set up things from the scratch on the Azure / O365 side myself, but it definitely sounds like it should be enough. The usual process involves setting up an app on the Azure side, so I'd look into that first – preferably you should ask someone (sysadmin, IT support, etc.) from the client to set this up, or at least help with it ?1 point
-
I've used this on a couple of projects to authenticate against Azure, and can definitely recommend it. Getting the config right can be a bit tedious, but other than that it's a no-brainer, and the module does all the heavy lifting for you ?1 point
-
Implemented in dev but not tested yet ?1 point
-
RE Branding Thank you all for the conversation so far ?. Just some quick pointers/thoughts: There are two areas of branding that have been referred to so far. The first one is what users see when they log into the backend. The second has more to do with selling the product, aka marketing. Regarding the first one, unlike the present Padloper, the name Padloper will not appear anywhere in the shop. Btw, you will be able to call your shop whatever you want - store, shop, blah blah. So, reports, taxes, etc, will all just be part of the shop. No extra shop links outside the shop itself. Regarding the second issue of marketing, I am not an expert, so I'll pause and have a listen. However, @teppo is right. The name does already have some brand value and the product 'has been selling itself', so to speak. I am not saying things cannot be improved. In addition, and I am just thinking out loud here, I don't have the stats for how many people have come to ProcessWire because of Padloper. My gut feeling is probably not that many (if any at all). On the contrary, I think most Padloper users (I am referring to devs) were already ProcessWire users and needed an eCommerce solution. Of course, we can always aspire for the former case (Padloper attracting people to ProcessWire), but that's probably a longer term discussion.1 point
-
For the sake of marketing and brand recognition I'd recommend not going with a generic name such as pw + [some commerce related term]. Best known brand names tend to be unique, and they don't really have to have any connection with the company/product (although they can). Trader is a decent idea, but I still think that Padloper is better -- not to mention that it already has some brand value, and an awesome logo ? just my five cents.1 point
-
@Robin S Setting the header in the vanilla JS XMLHttpRequest solved the actual problem. $config->ajax works as expected, now. Thank you! @Zeka A quite useful hint, which helped to improve the code. Thanks!1 point
-
Not sure if anybody is already using it... I'm using it every day and I'm extending the api from time to time. Today I added a setFieldOrder() method. Now it is quite easy to change the order of fields and set new column widths: // adjust field widths $rm->setFieldData('project', ['columnWidth'=>33], 'rockinvoice'); $rm->setFieldData('inv_date', ['columnWidth'=>33], 'rockinvoice'); $rm->setFieldData('type', ['columnWidth'=>34], 'rockinvoice'); $rm->setFieldData('invoicetomarkup', ['columnWidth'=>100], 'rockinvoice'); $rm->setFieldData('due', ['columnWidth'=>25], 'rockinvoice'); $rm->setFieldData('paid', ['columnWidth'=>25], 'rockinvoice'); $rm->setFieldData('num', ['columnWidth'=>25], 'rockinvoice'); $rm->setFieldData('sap', ['columnWidth'=>25], 'rockinvoice'); $rm->setFieldOrder([ 'type', 'invoicetomarkup', 'due', 'paid', 'num', 'sap', ], 'rockinvoice');1 point
-
I answered you on IRC, but then you quit. I will just share my docker-compose.yml in case you want to try it out (for local development): version: '3.0' services: caddy: image: abiosoft/caddy:latest volumes: - /path/to/local/directory/Caddyfile:/etc/Caddyfile - /path/to/local/directory/processwire:/srv ports: - "2015:2015" links: - mariadb - php-fpm restart: always mariadb: image: bianjp/mariadb-alpine:latest environment: MYSQL_DATABASE: mydb MYSQL_USER: mydb MYSQL_PASSWORD: mypass MYSQL_ROOT_PASSWORD: mypass volumes: - /path/to/local/directory/mariadbdata:/var/lib/mysql - /path/to/local/directory/override.cnf:/etc/mysql/conf.d/override.cnf ports: - "3306:3306" restart: always php-fpm: image: wodby/php:latest environment: PHP_FPM_USER: wodby PHP_FPM_GROUP: wodby PHP_MAX_EXECUTION_TIME: 180 PHP_MEMORY_LIMIT: 4096M PHP_UPLOAD_MAX_FILESIZE: 4096M PHP_POST_MAX_SIZE: 4096M PHP_MAX_INPUT_TIME: 180 PHP_MAX_INPUT_VARS: 10000 volumes: - /path/to/local/directory/processwire:/srv restart: always I use that separate wodby php, because I can define the running user/group to be "wodby", which has ID 1000, so I don't have to fiddle with my local file ownership (same ID as my host user). As you see, I have PW's files on local disk and also the database + Caddy and MariaDB configs.1 point
-
You would need to install the LanguageSupport module but I don't think there's any inefficiency in doing that. You don't need to actually create any additional languages - you just edit the default language to override whatever strings you want. I believe that's the standard PW way for customising strings so I wouldn't want to reinvent the wheel and create configurable fields for every string.1 point