Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/05/2017 in all areas

  1. Between a lot of big, not-web-related projects at work, I could squeeze in having a little a fun with ProcessWire too. What was needed was a shop-like solution where employees can order lunch snacks from our local butcher. Previously, this was handled with hand-written lists in each production hall that would be forwarded over fax to the butchers, leading to all kinds of transliteration and pricing errors. Our Central Services department looked at different software packages for that, but none of them did exactly what they needed. ProcessWire to the rescue. In little more than two days, I got a fitting solution up and running: PW 3.0.52 The only two non-standard modules used are @adrian's AdminActions and my own DatetimeAdvanced Role based template access UIKit 3 with modals, flex layout, mobile-ready with hamburger menu on smaller devices Everything is a page Synchronisation of employee accounts from time management software (> 600) into PW (120 lines, runs twice a day) Mixed authentication (Windows Active Directory if user is available there, local password if not) Account balance system with manual deposits and automated checking / detuction / refunding for orders, complete transaction history visible for the user Article categories (page reference), product images (not used yet), simple product variants (1 level, text + price) Ordering contents of a shopping cart for a single day or multiple days ahead of time within (admin configurable) time constraints (order window for following day ends X hours before, holidays excluded, etc.) Delivery locations (buildings) changeable by users themselves Integrated favorites system Management area in frontend for balance bookings, managing articles, previewing orders Daily collected orders for the butchery are printed into PDF through fpdf with a tiny wrapper Product images option with thumbnails (currently not used) Small additions like price validity dates or saving and re-using shopping carts will be added over the next months The shop landing page with all relevant information: Articles are grouped by category and have dropdowns for variations (with optional price addition/discount): Editable shopping cart with option to order same selection for multiple days: Minimallistic product item editor:
    11 points
  2. This post covers what’s in ProcessWire 3.0.62 and provides an in-depth look at the final spec of markup regions, how they work, and how to use them. https://processwire.com/blog/posts/processwire-3.0.62-and-more-on-markup-regions/
    10 points
  3. Also here's a relevant post from the blog on why it's implemented. https://processwire.com/blog/posts/processwire-core-updates-2.5.27/#php-5.6-and-debuginfo
    4 points
  4. It was far easier than I had first expected, as I started without much external input and CI restraints, so I could stick with UIKit defaults and had no usability expectations to meet. So I stuck with the "keep it simple" philosophy. I'm tentatively planning to make a release bundle out of it (time is as always the factor), but need to strip out a few specifics first and replace them with more generic code. There are also a few things which I simply stuck into site config but would merit a dedicated config page (think addresses, currency, holidays, time constraints and all that).
    3 points
  5. Thanks again guys, Just a quick update for anybody else who might run into this. Simply filtering out these: RewriteCond %{REQUEST_URI} !\.(cgi|pl|asp|rar|zip)$ [NC] RewriteCond %{REQUEST_URI} !wp-.*\.php$ [NC] ...took care of my problems. (No more crashes too) Cheers!
    3 points
  6. Take a look at the __debugInfo() method.
    3 points
  7. I've written a module called HTMLBodyClasses that renders classes for the <body> tag. echo HtmlBodyClasses::renderClasses($page); Outputs: <body class="home template-home page-id-1"> Page name, page template, page's ID. You can get it here: https://github.com/ethanbeyer/HtmlBodyClasses
    2 points
  8. I think I get it now - you are talking about a "Fieldset in Tab" fieldtype, right? An InputfieldWrapper is something different. Thanks for the report - should be fixed in v0.0.3.
    2 points
  9. There is! As @Robin S suggested, set the family relation for the templates and set a value on the "Name format for children" field.
    2 points
  10. As long as you don't overwrite the core api variables you can do whatever you need to do. $user is not locked, only $users is and here's a bit about the difficulties to extend those: https://github.com/ryancramerdesign/ProcessWire/issues/1412
    2 points
  11. @bmacnaughton, give the following hook a try (must be in /site/init.php or in init method of module). Seems to work well for both PageTable additions and edits of existing items. $this->addHookBefore('InputfieldPageTableAjax::checkAjax', function($event) { $page_id = (int) $this->input->get('id'); $item_id = (int) $this->input->get('InputfieldPageTableAdd'); if($page_id) $page = $this->pages->get($page_id); // $page is the container page if($item_id) $item = $this->pages->get($item_id); // $item is the PageTable item // ... }); Edit Nov 2017: more information in this post...
    2 points
  12. I created a simple module that allows you to log in using your e-mail address rather than username: https://github.com/m...lAuthentication A couple of thoughts: This should be a built-in option in the login module, rather than an add-on - most sites have taught users to log in with their e-mail address. (I tend to forget what my username is - on most sites I don't have one!) The Session and ProcessLogin APIs need to be more extensible - for instance, to allow modifications to the form or fields. Modules like "login via Twitter" etc. will soon be something that people demand. I wish the build...form() methods in PW were more generally open to hooks...
    1 point
  13. Little admin helper module: Using this module you can view all template cache settings at once. E.g. cache status, cache time (configurable). Furthermore it adds the functionality to clear the entire template cache or just the template cache for a given template. Note that this may cause a temporary delay for one or more requests while pages are re-cached. GitHub: https://github.com/justb3a/processwire-templatecacheoverview
    1 point
  14. Got it. There was a Redirect after a setting a cookie Damn
    1 point
  15. You're all wrong and most only work with entries already added and saved to the pagetable. It doesn't work for when adding a new item, cause the new entry page isn't saved yet to the pagetable field... Only easy way is to store them as children, so you can check for the parent. But storing the entries in a different place there's no way to tell in the newly created entry what source page it is going to land in. I created a github issue 3! years ago https://github.com/ryancramerdesign/ProcessWire/issues/699 and never got a single response from Ryan... The solution I came up with was to store the id in the session and transfer that over to the page edit of the entry, Since I had not autoname feature enabled there, there was a step in between where the entry page isn't even created yet. Kinda hacky but worked. The other issue I got with PageTable also never got answered https://github.com/ryancramerdesign/ProcessWire/issues/700
    1 point
  16. Just adding to what abdus and Macrura have said: you use URL segments to do this, but you don't need to hook page paths or render any different page. Your category pages can use a template with only a title field and with no corresponding template file - these category pages only exist for the purpose of being selected in a Page Reference field in your news article pages. In your 'news' template (the template of the parent page of the news articles) you check for a URL segment and if there is one you use that in a selector to match only news articles that have that category selected. You can do a kind of sanitizing of the URL segment by first checking if there is any page by that name using your category template or under your category parent - if there isn't then you throw a 404.
    1 point
  17. usually for areas like news, blog, events, the best practice is to check for the URL segments as mentioned by abdus. You can look at the blog module or blog profile to possibly see some functions for how to intercept the segment, and display the filtered posts.
    1 point
  18. You can use url segments to achieve this.
    1 point
  19. @theoretic @ZGD It seems like this commit fixed the compiler hickup: https://github.com/LostKobrakai/Migrations/commit/d22e6b4c5a5726e320dae0f6bd586578ad19a3b7
    1 point
  20. Thank you for the update. It works great. I'm settng the locale by translating the "C" string on LanguageSupport.module on each language which is the easiest method. The other method would be to add a field for locale inside the system's template "language". I've changed the default's language locale from english to german and the module updates the page name from oct-17-2018 to okt-17-2018. So PW is aware of the datetime's language. Do you think you can get the locale from the "C" string on LanguageSupport.module or from a field under the template "language" so the module can update the additional language page names too?
    1 point
  21. @PWaddict OK. I fixed the issue. For datetimefields the format will be pulled from the field settings including strftime formats. Datetime fields are not true multilanguage fields. The language-specific output of a datetime field can not be influenced by changing the user language. In a template, the output will be language-sensitive only by using setlocale() and if strftime formats for output are set in the datetime field settings. Inside PW datetime fields are not aware of the language. It would actually be desirable to have a field for setting locales in Processwire for each language or an option to set the locale in datetimefields settings. You maybe want to start a topic in the wishlist and roadmap section to point out Ryan.
    1 point
  22. Unfortunately there's no good solution to this that I can see while still using ProcessPageEditLink (i.e. the link modal window). That's because ProcessPageEditLink applies $sanitizer->url to existing link hrefs and the options for it are not configurable within the module. And even if the options were configurable it turns out that it's impossible for javascript links to pass this sanitizer because PHP's FILTER_VALIDATE_URL is always applied. The workings of ProcessPageEditLink seem a bit inconsistent to me so I have opened a GitHub issue. A workaround you could use is to create a Hanna code for inserting javascript links, with attributes for 'href' and 'text'. If you install Hanna Code Dialog you can get a dialog UI in CKEditor.
    1 point
  23. @LostKobrakai - thank you! link is very helpful. P.S. and thank you for article - helped me a lot to better structure and maintain the code.
    1 point
  24. One more option: when debug mode is true you can hover the inputfield open/close toggle to see the field name.
    1 point
  25. Thanks for the module. I would like to report that It seems that this module is breaking the inputfieldwrapper field. When I edit the inputfieldwrapper field, it shows error as following. Error: Uncaught TypeError: Argument 2 passed to ProcessWire\InputfieldWrapper::insertAfter() must be an instance of ProcessWire\Inputfield, null given, called in /var/app/current/site/modules/CustomInputfieldDependencies/CustomInputfieldDependencies.module on line 136 and defined in /var/app/current/wire/core/InputfieldWrapper.php:296 Stack trace: #0 .../site/modules/CustomInputfieldDependencies/CustomInputfieldDependencies.module(136): ProcessWire\InputfieldWrapper->insertAfter(Object(ProcessWire\InputfieldTextarea), NULL) #1.../wire/core/WireHooks.php(782): CustomInputfieldDependencies->addFieldOptions(Object(ProcessWire\HookEvent)) #2 .../wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Field), 'getConfigInputf...', Array) #3 .../wire/modules/Process/ProcessField/ProcessField.module(943): ProcessWire\Wire->__call('getConfigInputf...', Array) #4 .../wire/core/Wi (line 296 of /var/app/current/wire/core/InputfieldWrapper.php)
    1 point
  26. Hi mrkhan, You have to fill-in "ar" in the arabic name field on the home page.
    1 point
  27. I do not have the time to present an exact solution, but I think it is worth to mention that @Robin S came up with something similar using Hanna Codes (it uses the description field for such purposes, but should work in any admin themes):
    1 point
  28. ProcessWire is mentioned in the repository Awesome UIkit:
    1 point
  29. Hi @phil_s Also check this blog post from Ryan Filtering out common WordPress files
    1 point
  30. ookay..just entered title in name format for children and modify it from the setupNew hook thanks to you @Robin S
    1 point
  31. On the parent page template, if you select a single allowed template for children and specify a "Name format for children" then the first step of the "Add New" page process should be skipped. To set the name the core name format setting might be sufficient, or you have more options with kixe's module, or you can use your own hook: $this->pages->addHookBefore('setupNew', function($event) { $page = $event->arguments('page'); if($page->template == 'my_template') { $page->name = 'some-name'; } });
    1 point
  32. I just made the 0.3.0 version the new stable version. I've also added 0.3.1-beta with a new migration type: AccessMigration. This migration is only meant to change access rules for templates like shown below. List templates with changes, prepend a + or - if the useRoles setting does need to change. For those templates then list all roles which have changes (can be none) and supply which types of access should be added or removed. <?php class Migration_… extends AccessMigration { public static $description = "Update template access rules"; protected function getAccessChanges() { return [ '-blogpost' => [], // Remove useRoles from blogpost template '+basic-page' => [ // Add useRoles to basic-page 'subscriber' => ['+view'], 'editor' => ['+view', '+edit'], 'admin' => ['+view', '+edit', '+create'] // +create does require +edit ], 'tag' => [ 'subscriber' => ['-edit'], 'admin' => ['+full'] // view, edit, create and add ] ]; } } Edit: Had to remove the automatic +edit for +create, otherwise it's not clear to what to revert on rollbacks.
    1 point
  33. I've just tagged 0.3.0-RC1 on Github. I've replaced league/climate with symfony/console to allow for more advanced parameter parsing => nicer commands. Documentation on the new cli commands by now can be found running migrate or migrate [command] -h. The commands migrate/rollback do now support multiple arguments from the cli as well as via the processwire module: integer: migrate/rollback that number of files filename (/path, but does fallback to filename comparison) classname * : migrate/rollback all ("*" in the terminal) In addition to that does migrate also have an option to only use "latest" migrations, which are the ones newer than the latest migrated file instead of all files not migrated. Other changes: Made the mysql table name lowercase to prevent issues with case sensitivity. Migration files are now managed via custom WireData/WireArray classes, which made the code quite a bit nicer than passing around just filenames. Custom migration templates can be put in /site/migrations/templates/. These can be created via migrate create:custom -t [type]. I'd appreciate it if some of you guys could take a look at it if there are any issues I've missed.
    1 point
  34. I can think of different ways to deal with this one. Printout: As someone suggested in the forums (Maybe Renobird?), they print out a list of all the fields on their site and what the fields are for. Admin page: Maybe create a hidden page, under Admin, with a list of all the fields and what they represent for each company? Custom Admin page: Create a custom admin page using Diogo's Admin Custom Page module that renders only for superuser showing you the list of fields and what they represent for each company. Maybe this is best because you can view it as read only and can get as creative as you want with the output Just thinking out loud here...
    1 point
  35. Looks good, thanks for making it! This login is meant for the admin, but when building your front-end site login, it's just as simple to use email address as it is name. Likewise, this is where I'm guessing the other types of logins (twitter, etc.) would be more likely to be implemented. But even if for admin, I really like that this module opens up the option to login by email and think others will too. I'm not sure I agree that it should be built-in, as I want to pick a consistent standard and stay with it. So I actually think it's a perfect use case for a module, and think you solved it very nicely. The only concern with using email addresses as logins is that they aren't guaranteed to be unique. After all, email is just a ProcessWire fieldtype (not something built into the pages table) and someone could be maintaining two accounts with the same email address (as I often do). So when building this functionality on the front-end, I usually do something like this: $us = $users->find("email=$email"); foreach($us as $u) { if($u->pass === $pass) { // found the right one } } I add hooks for anything that people want. But they don't get that way until someone asks for them. There is naturally a little more overhead associated with a hook function than there is with a native function, so I don't want to go off and make everything hookable just because it can be. It takes very little effort to make something hookable (just adding 3 underscores to the beginning) so it would be easy to get carried away with it. I can't predict everything that people would want to hook, so instead let the users decide what they want to hook and I add those 3 underscores and we're done. Easy. All you have to do is ask. If there is one thing I can do quickly, it's type 3 underscores. Your ReflectionClass hack may not be necessary (though I did think it was quite a cool hack). Instead, I think you may be able to do this: $form = $event->return; $field = $form->get('login_name'); $field->label = $this->_('E-mail Address');
    1 point
  36. The main reason it's not there is just because $input is another layer on top of $_POST (or $_GET or $_COOKIE) and I wanted to limit the overhead of it as much as possible, at least until we needed it. Didn't want to enable the possibility of someone posting endless multidimensional arrays from a security standpoint. But ultimately if the need was there, I would add it. And now that its come up, we might as well add it. Probably what I will do is just limit the recursion to 2 or 3 levels to keep it safe. I don't see any potential issues with adding it. If you've had the need for it, then I'm sure others will to. If you want to submit a pull request, I'll bring it into the core. Otherwise, I'll plan to add and commit an update to the core soon. Thanks, Ryan
    1 point
×
×
  • Create New...