Leaderboard
Popular Content
Showing content with the highest reputation on 01/04/2017 in all areas
-
http://caniuse.com/#feat=css-grid The CSS standard Grid Layout will soon be usable in the stable versions of the leading browsers. It should hit Chrome and Firefox in March. It is in Safari tech preview, but no clear date. MS Edge is working on updating support. I guess support in mobile browsers will follow. 2017 is the year to use it on sites, where it is OK to experiment with bleeding edge stuff. A complete guide to the system on CSS Tricks Learn by examples (includes video tutorials) Rachel Andrews summarizing use cases for Grid, Flexbox and Box Alignment in a single article on Smashing Mag (note: heavy with Codepens) News on all things CSS Layout curated by Rachel Polyfill support is unfortunately dragging behind with no contributors stepping up to help Fremy3 points
-
The module you are using is pretty old (<2.4 support). An alternative might be to use CroppableImage. Read more about the 3.x release in this thread.3 points
-
Happy New Year to everyone! For a project that I'm working on, I needed to have dependent checkboxes on page edit forms in the admin. Just like dependent selects but for checkboxes. I couln't find anything and decided to write my first Inputfield module. I have only tried it on PW > 3.0. But it should also work on the 2.x branch. Would be great if some of you could try it out and give some feedback. You can find the module InputfieldDependentCheckboxes at github Here's some screenshots of the module in action and instructions on how to use it. ##An Inputfield for ProcessWire admin interface that handles the display of dependent checkboxes in page fields Sometimes we need checkboxes to depend on other checkboxes in our page edit forms. This module adds this functionality to standard page field checkboxes for 2 or more checkbox fields. ## Installation 1. Copy all of the files for this module into /site/modules/InputfieldDependentCheckboxes/ 2. In your admin, go to the Modules screen and click "Refresh". Under the 'Inputfield' section, install the 'InputfieldDependentCheckboxes' module. 3. Open Modules->Configure->InputfieldPage. Under 'Inputfield modules available for page selection' add 'DependentCheckboxes' from the select dropdown and submit ##Field Setup This inputfield extends the standard checkboxes for page fields. Therefore you need to have page fields configured already that you can extend with this Inputfield type. ###Prerequisites You need to have at least 2 fields of type page that have 'Checkboxes' defined as Input field type and live on the same template. A real world example: There are different types of instructors. Each instructor type can have multiple different certifications. For this to happen, we need 2 page fields (multiple): A) instructor_types: lists pages with template 'instructor_type' B) certifications: lists pages with template 'certification' The certification template needs to have the instructor_types page field to assign one or more instructor_types to a certification. ###Setup (link checkbox fields) 1. Edit your page field A and go to the 'Input' Tab. Under 'Input field type' choose 'DependentCheckboxes'. Hit save. Now under 'Choose the target checkboxes field' choose the name of your field B. Hit save again. 2. In your page field b make sure to choose a template under 'Input' Tab under 'Selectable Pages'->'Template of selectable page(s)'. Your fields should be setup. If you now edit a page that contains the 2 fields, the dependent checkboxes should be working. EDIT: And yes, this is working for multiple dependent checkboxes, too. (I have tried it with 3 so far) Some notes on how the module works behind the scenes: - parent checkboxes (actors) that have dependent checkboxes (targets) get custom data attributes applied which contain arrays of the targets' IDs - some Javascript is initiated on acxtors and targets to handle the display based on the id arrays in the data attributes. EDIT: since this module's mention in ProcessWire Weekly it might get some more attention. I just wanted to point out that it is still in alpha state. I will continue development and more thorough testing while implementing it in an ongoing project within the next 3-5 months or so. I will eventually release a stable version then. If you use the module with only 2 dependent checkbox fields, it should work smoothly. There are still some quirks when using 3 or more and I need to figure out how to best resolve them. So please be patient (or jump in with ideas ).3 points
-
TextformatterTypographer A ProcessWire wrapper for the awesome PHP Typography class, originally authored by KINGdesk LLC and enhanced by Peter Putzer in wp-Typography. Like Smartypants, it supercharges text fields with enhanced typography and typesetting, such as smart quotations, hyphenation in 59 languages, ellipses, copyright-, trade-, and service-marks, math symbols, and more. It's based on the PHP-Typography library found over at wp-Typography, which is more frequently updated and feature rich that its original by KINGdesk LLC. The module itself is fully configurable. I haven't done extensive testing, but there is nothing complex about this, and so I only envisage a typographical bug here and there, if any.2 points
-
Happy New Year! Looking back over the last year, it's been a really great year for the project, and wow has it gone fast! In this post we'll look back at some of what we've accomplished over the last year, and–more importantly–introduce and review our 2017 roadmap. Today we've also released version 3.0.47 dev, which doesn't add anything new feature wise, but does contain several optimization and bug fix comments. https://processwire.com/blog/posts/roadmap-2017/2 points
-
Actually the link to Github from that post is out of date. This is the current version of the module for PW 3: https://github.com/horst-n/CroppableImage3 @horst - looks like there is something a little weird with the module directory: http://modules.processwire.com/modules/croppable-image3/ It is showing that the module hasn't been updated since September 2, 2016. Any ideas?2 points
-
Inputfield dependency selectors work by parsing the values of the html <input>'s and alike. If a field is not editable these are rendered at all. If you need visibility selectors to work with fields hidden/not editable use a hook after ProcessPageEdit::buildForm instead.2 points
-
Ok. I had to fine tune some of the possible search errors, so I added the code and error message if no results are found as well as if a search is initiated without keywords etc. Here is the code used of the search.php and search-form.php, so please do not spare the mercy and share honestly if you see something that can be improved in the code. In order to implement the search you need to create add the template using search.php and then create a page (I called it Search Results, as I used the title in the headline) which use search template. As far as the needed functionality so far is achieved with the search, I am moving forward starting to create some real howtos and group them in the proper parents that would be shown on the main page. I am not expecting to have difficulties doing that as the API seems pretty straight forward even for my non-programmers brain but if something comes up on the road, will search for a way to solve it. As per szabesz advice (thanks for the idea), I am adding the code in a spoiler block. So here is the content of search.php: And here is the code for the search-form.php:2 points
-
Thanks @szabesz - I really appreciate everyone's positive feedback and support for this module - glad it's been useful for everyone! Good luck with your new project.2 points
-
Hi everyone, Here's a new module that I have been meaning to build for a long time. http://modules.processwire.com/modules/process-admin-actions/ https://github.com/adrianbj/ProcessAdminActions What does it do? Do you have a bunch of admin snippets laying around, or do you recreate from them from scratch every time you need them, or do you try to find where you saw them in the forums, or on the ProcessWire Recipes site? Admin Actions lets you quickly create actions in the admin that you can use over and over and even make available to your site editors (permissions for each action are assigned to roles separately so you have full control over who has access to which actions). Included Actions It comes bundled with several actions and I will be adding more over time (and hopefully I'll get some PRs from you guys too). You can browse and sort and if you have @tpr's Admin on Steroid's datatables filter feature, you can even filter based on the content of all columns. The headliner action included with the module is: PageTable To RepeaterMatrix which fully converts an existing (and populated) PageTable field to either a Repeater or RepeaterMatrix field. This is a huge timesaver if you have an existing site that makes heavy use of PageTable fields and you would like to give the clients the improved interface of RepeaterMatrix. Copy Content To Other Field This action copies the content from one field to another field on all pages that use the selected template. Copy Field Content To Other Page Copies the content from a field on one page to the same field on another page. Copy Repeater Items To Other Page Add the items from a Repeater field on one page to the same field on another page. Copy Table Field Rows To Other Page Add the rows from a Table field on one page to the same field on another page. Create Users Batcher Allows you to batch create users. This module requires the Email New User module and it should be configured to generate a password automatically. Delete Unused Fields Deletes fields that are not used by any templates. Delete Unused Templates Deletes templates that are not used by any pages. Email Batcher Lets you email multiple addresses at once. Field Set Or Search And Replace Set field values, or search and replace text in field values from a filtered selection of pages and fields. FTP Files to Page Add files/images from a folder to a selected page. Page Active Languages Batcher Lets you enable or disable active status of multiple languages on multiple pages at once. Page Manipulator Uses an InputfieldSelector to query pages and then allows batch actions on the matched pages. Page Table To Repeater Matrix Fully converts an existing (and populated) PageTable field to either a Repeater or RepeaterMatrix field. Template Fields Batcher Lets you add or remove multiple fields from multiple templates at once. Template Roles Batcher Lets you add or remove access permissions, for multiple roles and multiple templates at once. User Roles Permissions Batcher Lets you add or remove permissions for multiple roles, or roles for multiple users at once. Creating a New Action If you create a new action that you think others would find useful, please add it to the actions subfolder of this module and submit a PR. If you think it is only useful for you, place it in /site/templates/AdminActions/ so that it doesn't get lost on module updates. A new action file can be as simple as this: <?php namespace ProcessWire; class UnpublishAboutPage extends ProcessAdminActions { protected function executeAction() { $p = $this->pages->get('/about/'); $p->addStatus(Page::statusUnpublished); $p->save(); return true; } } Each action: class must extend "ProcessAdminActions" and the filename must match the class name and end in ".action.php" like: UnpublishAboutPage.action.php the action method must be: executeAction() As you can see there are only a few lines needed to wrap the actual API call, so it's really worth the small extra effort to make an action. Obviously that example action is not very useful. Here is another more useful one that is included with the module. It includes $description, $notes, and $author variables which are used in the module table selector interface. It also makes use of the defineOptions() method which builds the input fields used to gather the required options before running the action. <?php namespace ProcessWire; class DeleteUnusedFields extends ProcessAdminActions { protected $description = 'Deletes fields that are not used by any templates.'; protected $notes = 'Shows a list of unused fields with checkboxes to select those to delete.'; protected $author = 'Adrian Jones'; protected $authorLinks = array( 'pwforum' => '985-adrian', 'pwdirectory' => 'adrian-jones', 'github' => 'adrianbj', ); protected function defineOptions() { $fieldOptions = array(); foreach($this->fields as $field) { if ($field->flags & Field::flagSystem || $field->flags & Field::flagPermanent) continue; if(count($field->getFieldgroups()) === 0) $fieldOptions[$field->id] = $field->label ? $field->label . ' (' . $field->name . ')' : $field->name; } return array( array( 'name' => 'fields', 'label' => 'Fields', 'description' => 'Select the fields you want to delete', 'notes' => 'Note that all fields listed are not used by any templates and should therefore be safe to delete', 'type' => 'checkboxes', 'options' => $fieldOptions, 'required' => true ) ); } protected function executeAction($options) { $count = 0; foreach($options['fields'] as $field) { $f = $this->fields->get($field); $this->fields->delete($f); $count++; } $this->successMessage = $count . ' field' . _n('', 's', $count) . ' ' . _n('was', 'were', $count) . ' successfully deleted'; return true; } } This defineOptions() method builds input fields that look like this: Finally we use $options array in the executeAction() method to get the values entered into those options fields to run the API script to remove the checked fields. There is one additional method that I didn't outline called: checkRequirements() - you can see it in action in the PageTableToRepeaterMatrix action. You can use this to prevent the action from running if certain requirements are not met. At the end of the executeAction() method you can populate $this->successMessage, or $this->failureMessage which will be returned after the action has finished. Populating options via URL parameters You can also populate the option parameters via URL parameters. You should split multiple values with a “|” character. You can either just pre-populate options: http://mysite.dev/processwire/setup/admin-actions/options?action=TemplateFieldsBatcher&templates=29|56&fields=219&addOrRemove=add or you can execute immediately: http://mysite.dev/processwire/setup/admin-actions/execute?action=TemplateFieldsBatcher&templates=29|56&fields=219&addOrRemove=add Note the “options” vs “execute” as the last path before the parameters. Automatic Backup / Restore Before any action is executed, a full database backup is automatically made. You have a few options to run a restore if needed: Follow the Restore link that is presented after an action completes Use the "Restore" submenu: Setup > Admin Actions > Restore Move the restoredb.php file from the /site/assets/cache/AdminActions/ folder to the root of your site and load in the browser Manually restore using the AdminActionsBackup.sql file in the /site/assets/cache/AdminActions/ folder I think all these features make it very easy to create custom admin data manipulation methods that can be shared with others and executed using a simple interface without needing to build a full Process Module custom interface from scratch. I also hope it will reduce the barriers for new ProcessWire users to create custom admin functionality. Please let me know what you think, especially if you have ideas for improving the interface, or the way actions are defined.1 point
-
FieldtypeFileS3 https://github.com/f-b-g-m/FieldtypeFileS3 The module extends the default FieldtypeFile and InputfieldFile modules and adds few extra methods. For the most part it behaves just like the default files modules, the biggest difference is how you get the file's url. Instead of using $page->fieldname->eq(0)->url you use $page->fieldname->eq(0)->s3url(). Files are not stored locally, they are deleted when the page is saved, if page saving is ommited the file remains on the local server until the page is saved. Another difference is the file size, the default module get the file size directly from the local file, while here it's stored in the database. There is an option to store the files locally, its intented in case one wants to stop using S3 and change back to local storage. What it does is it changes the s3url() method to serve files from local server instead of S3, disables uploading to S3 and disables local file deletion on page save. It does not tranfer files from S3 to local server, that can be done with the aws-cli's through the sync function. Files stored on S3 have the same structure as they would have on the local server. -------------------------------------------------------- -------------------------------------------------------- Been struggling with this for quite a while, but i think i finally managed to make it work/behave the way i wanted. All feedback is welcome!1 point
-
1 point
-
@heldercervantes...if you haven't done so already, you want to request @ryan to add you to FB's VIP support forum (assuming your purchase's support is still active).1 point
-
Thanks, @Robin S. I think kongondo's answer solves my issue. For now I do not seem to need the ability to check what permissions are added by the module. Thanks for the support.1 point
-
How about adding a link to the Tracy module settings page to the Panel selector panel?1 point
-
I guess you need to set "Yes" in "Default language homepage URL is same as root URL?" here: /admin/module/edit?name=LanguageSupportPageNames Plus adjust the Home page's url at its Settings tab (enter "en"). Then examine the url in your home template file and if it's only "domain.com" (without "/en") then show the welcome page.1 point
-
HTML renders fine for CKEditor fields. For text or textarea fields there are two possibilities: Strip the tags... $this->addHookBefore('Fieldtype::markupValue', function($event) { $field = $event->arguments('field'); $page = $event->arguments('page'); $value = $event->arguments('value'); if($field->name == 'my_field' && $page->template->name == 'my_pagetable_template') { $event->arguments('value', $this->sanitizer->textarea($value)); } }); ..or decode entities (being mindful of potential security risks that this opens up)... $this->addHookAfter('Fieldtype::markupValue', function($event) { $field = $event->arguments('field'); $page = $event->arguments('page'); if($field->name == 'my_field' && $page->template->name == 'my_pagetable_template') { $event->return = html_entity_decode($event->return); } });1 point
-
@Ivan Gretsky, did kongondo's reply solve your issue? If you mean the additional template restrictions added by TemplatesChildPages, I didn't include a method for returning the allowed templates as the module is only intended as an admin helper (and it only autoloads on admin pages). If you still have a need to get the module's template restrictions for a given parent via the API let me know and I'll look at adding a method for that purpose.1 point
-
Hey @adrian Thanks for your reply. I've asked my contractor how the csv file must be classified. He gave me an example which you can see in the attachment. There is one product in the attachment, but the same needs to happen for all products and categories. Languages are seperated per column. Each product in a row, Same for categories. I hope this helps you, I will also think for a solution in the code of the module altough I don't have that much experience with exports to csv formats. Note: With my 18 yrs I expect you're way better than me, but I will give it a try to think about it -Edit- I wrote a module to get the categories and products (and more stuff) from the prestashop database and import the data in Processwire. What would be easier, write another piece of code in my module/or new module to get the data out of the database and directly import it to a csv file, or just make a csv file from the data in the Processwire fields? Sorry for so many questions, still a bit newbie here I guess example.xlsx1 point
-
Hi @Timothy de Vos - I could simply support HTML in that email body field and have the email sent as HTML along with a plain text version (automatically generated from the HTML version). I think that would be the easiest approach. Would that suit your needs?1 point
-
Hi, I'd like to add a styled email to new users but when I use the Email body field i can't use html. What would be the best way to add a custom email template?1 point
-
I can only concur that this has been a great year. It was nearly impossible not to get infected by the momentum of PW's development. Love (that's an understatement) the JS $pages API plan, and the pages export/import function could even be a solid base for native staging support, just by hooking into the proper PW actions and filling a staging actions table. You're absolutely right, @apeisa, PW is much more than just a brilliant website platform. Our intranet site really does some "heavy lifting", consolidating information from the ERP system, the DMS, personnel and operational time keeping, financial accounting and a few proprietary databases. That way, it also serves as the middleware for a big, distributed test run database. Like Sense, it drives a few chained workflows, e.g. for bridging the feedback gap between dunning proposals and our sales managers. All our intra-company course scheduling/booking runs on PW too, including supervisor approval, and it was surprisingly easy to implement. HR was over the moon with PW's ease of use. For 2017, we're planning a site that provides our customers with all the publicly available documentation for the machines and plant parts we sold them, requiring just a QR code scan on their side. Setting up a working (UIKit styled, multilingual) prototype only took me a few hours and really impressed our sales guys If 2017 is going to be anything like this year, it's going to be a blast. Thank you @ryan! A happy, healthy and inventive new year to everyone!1 point
-
Great blog post Ryan, thank you! Great year behind and even better coming! What comes weekly news, I think maybe @teppo and PW Weekly could report interesting new stuff from dev branch - instead of full blog post by @ryan each week? Also I think what would really help PW as a community project is that modularity would be more easily seen from code repositories also. I mean separation of /wire/ from rest of the stuff, keeping admin as own project and making several core modules as their own projects (although they could be "essentials" that would always be installed with ProcessWIre). What comes to Avoine, I hope I found time to write case story about how we use ProcessWire as backend solution to our member register platform Avoine Sense. Sense was released early 2016 and it already hosts about 10 member registers that together hold about 150 000 members. Feature-wise Sense already has newsletters, custom reporting tool, invoicing, model based templates/fields, background jobs, client specific procedures build by chaining actions (ie. create excel, connect ftp, deliver file and finally send sms to admin), full read/write REST API with Oauth2 authentication, mobile application, embeddable login/edit forms etc... ProcessWire has been amazing platform for our application development (currently we have 4-5 developers working on it). I strongly encourage that you all consider ProcessWire as a viable alternative for serious application development also. It is perfect platform for building dynamic websites, but it is also pretty brilliant platform for application development!1 point
-
Yes, definitely We cannot thank you enough for this module, but at least we need to try! Anyway, the even stronger support of ajax debugging came just the right time for me, as I am about to start a new project utilizing lots of ajax magic.1 point
-
A few more updates to mention. 1) Tracy now correctly reports warnings/notices coming from PW's file/image AJAX uploads For those following the thread on CustomUploadNames and on Github, not only did Ryan make some changes in the PW core to make this work, but David Grudl over at Nette also added a workaround that now allows Tracy to report errors from vanilla JS ajax calls, even if they don't call xhr.getAllResponseHeaders(); which should help with debugging your own vanilla js ajax calls as well. 2) Easy toggle for Strict Mode Not sure how many of you have played with the Strict Mode config setting. It turns notices and warnings into errors and shows a full expandable stack trace. For example, here is the above notice in Strict Mode. Clicking on the "source" and "arguments" on the entries further down the call stack can be very helpful! This is great, especially for AJAX notices/warnings which are often harder to dig into. The catch has always been that Strict Mode will halt your scripts for these notices/warnings, which can often be painful when you are early into something complex and just want to get it working before dealing with these. Now on the Panel Selector panel the new toggle button makes it easy to turn on Strict Mode when needed (note this is only available if Strict Mode is off in the module config settings): 3) Time and memory of Console Panel code I recently added time and memory of the code run in the console panel. Note the 11.59ms and 0.07MB at the bottom of the output. This could be very handy if you want to test the performance of different selectors or loops. Hope you guys find these new additions useful!1 point
-
Yes. A simple way would be hooking into ProcessPageListActions::getActions in your site/ready.php: wire()->addHookAfter("ProcessPageListActions::getActions", null, "removeNewAction"); function removeNewAction(HookEvent $event) { $page = $event->arguments(0); if($page->template == "blog") { $actions = $event->return; unset($actions['new']); $event->return = $actions; } }1 point
-
No, this is not needed, because the method redirect() calls "exit(0);" at the end. See class: https://github.com/processwire/processwire/blob/master/wire/core/Session.php Docs: https://processwire.com/api/ref/session/redirect/1 point
-
@FrancisChung, uhhm, I changed wire-> to $wire-> on the fly for the example to be more future ready with PW3 and possible multi instances. So, please, can you test if it works with this too: if($u) { $wire('user')->user = $u; } (see the preceding $, to invoke the instances aware $wire, and not the (static) main wire instance)1 point
-
With UTF8, it's no longer necessary to encode any characters outside those that have special meaning in HTML, so accented chars are fine as they are. If you enable the text formatter "HTML Entitiy Encoder (htmlspecialchars)" in the details tab of a field that contains plain text, it will take care of any necessary encoding on the fly. CKEditor will do its own conversion as you type, so manual conversion shouldn't be necessary anymore.1 point
-
$f4 = new Field(); $f4->type = $this->modules->get("FieldtypeOptions"); $f4->name = "name"; $f4->label = "Label"; $f4->save(); $manager = new SelectableOptionManager(); $options = 'red green blue'; // you can also set IDs and values if needed $manager->setOptionsString($f4, $options, false); $f4->save(); That did it, had to save the field before adding the options, took me a while to figure it out. Thanks for the help.1 point
-
The methods for setting new options for an Options field via the API seem to be a bit convoluted - I think it's probably an oversight and it would be worth raising a feature request at GitHub. There's a method that seems to be primarily intended for the admin back-end: setOptionsString(). You can use it but the way the options are defined (string with line break separator) is a bit weird for API use and it's not easy to get it to play nicely with existing options. $f = $fields->my_options_field; $manager = new SelectableOptionManager(); $options = 'red green blue'; // you can also set IDs and values if needed $manager->setOptionsString($f, $options, false); // if last argument is omitted/true you will remove any existing options Otherwise you could manually create SelectableOption objects, add them to a SelectableOptionArray, and use addOptions(), deleteOptions(), setOptions(), etc, with that SelectableOptionArray. See the module source code. It's hardly a simple process though. I think what's needed are methods to go from options to PHP array and PHP array to options.1 point
-
Could the modules list in the Versions List be in alphabetical order? It's hard to find a given module if it's not.1 point
-
This kind of error is usually because your code is overwriting the PW $user object. Try making your own user and password variable something like $u and $p, then there is no chance of that happening.1 point
-
@ro-bo thanks for the detailed instructions. I was able to duplicate it after following the steps in those instructions. And @LostKobrakai was right that there was a missing getBlankValue in the sanitizeValue method. This week's PW dev version will include this fix at the top of sanitizeValue: if(empty($value)) return $this->getBlankValue($page, $field);1 point
-
I'm not really sure how this is selecting 1|3 here, but there's certainly a lack in checking for empty strings in the FieldtypeOptions::sanitizeValue() function. To fix this add this right at the start of the function: if($value === ""){ return $this->getBlankValue($page, $field); }1 point
-
Hi LostKobrakai. Thanks for your answer. Here is a step-by-step guide: 1. Download Processwire 2.6.1 Master from http://processwire.com/download/ 2. Upload PW with site-blank profile to Server 3. Install PW 4. Login to PW-Backen 5. Modules -> Core -> Select Options -> Install 6. Setup -> Fields -> Add New 7. Basics Tab -> Name: test -> Type: Options -> Label: testfield 8. Details Tab -> Select (Single Value) -> Selectable Options: test1 (new Line) test2 (new Line) test3 9. Actions Tab -> Add Field to Template "Home" 10. Save (Add Field after title) 11. Pages Tab -> Home -> edit 12. Choose test1 -> Save 13. Choose "blank" (no Value/Option) -> Save 14. Now I check the Database and there are 2 Entries for the same page_id 15. open home.php with an editor -> write "echo $page->test;" under "include("./basic-page.php");" -> Save and upload it to the server 16. Open the Home Page (Frontend) with browser -> the echo command outputs "1|3" means 1 for the first Entry and 3 for the last entry. If I add an Option (see step 8) e.g. test4 the echo command outputs "1|4" aso. I have not done anything else! Meantime I tested it on two different Servers (My Local Server and EDIS-Provider where some PW-Pages run successfully) and the phenomenon continues to exist. I think (and Ryan confirmed it in the poste further above) that it's unusual -> the echo command should output no value (blank) instead of "1|2" or "1|3" ... Best Regards Robert1 point