Jump to content

Leaderboard

Popular Content

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

  1. This module corrects a few things that I find awkward about the "Add New Template" workflow in the PW admin. I opened a wishlist topic a while back because it would good to resolve some of these things in the core, but this module is a stopgap for now. Originally I was going to share these as a few standalone hooks, but decided to bundle them together in a configurable module instead. Add Template Enhancements A module for ProcessWire CMS/CMF. Adds some efficiency enhancements when adding or cloning templates via admin. Features Derive label from name when new template added: if you like to give each of your templates a label then this feature can save some time. The label can be added automatically when templates are added in admin, in admin/API, or not at all. There are options for underscore/hyphen replacement and capitalisation of the label. Edit template after add: when adding only a single template, the template is automatically opened for editing after it is added. Copy field contexts when cloning: this copies the field contexts (a.k.a. overrides such as column width, label and description) from the source template to the new template when using the "Duplicate/clone this template?" feature on the Advanced tab. Copy field contexts when duplicating fields: this copies the field contexts if you select the "Duplicate fields used by another template" option when adding a new template. Usage Install the Add Template Enhancements module. Configure the module settings according to what suits you. https://github.com/Toutouwai/AddTemplateEnhancements https://modules.processwire.com/modules/add-template-enhancements/
    11 points
  2. This week there's a new ProcessWire core version posted (version 3.0.79), as well as a new version of AdminThemeUikit posted. However, the focus this week was on covering issue reports and fixing little things, and I don't think it makes an interesting blog post, so we'll skip it this week. If you want to see what's new for 3.0.79, be sure to check out the dev branch commit log. While the changes to AdminThemeUikit were pretty little, the admin theme does continue to evolve nicely and I recommend grabbing it if you are using a previous version. Actually, even if you aren't using a previous version, I recommend grabbing it (along with the latest PW core version). Other than for a few small details and rare cases—in my opinion it's nearly production ready. Thanks for reading, and I hope everyone has a great weekend!
    10 points
  3. What about this in your ready.php file: $this->addHookBefore("InputfieldCheckboxes::render", function($event) { if($event->object->id != 'Inputfield_roles') return; $optionsWithTitles = array(); foreach($event->object->options as $id => $name) { $roleTitle = $this->wire('roles')->get($id)->title; $optionsWithTitles[$id] = $roleTitle != '' ? $roleTitle . ' ('.$name.')' : $name; } $event->object->options = $optionsWithTitles; }); In this screenshot I have only added a title to the "Editor" role:
    4 points
  4. Hi guys! What do you think about something like this? Because I use this option regularly in the Windows File Explorer breadcrumb and it's very useful. The drop-down menu can display only published/visible child pages. I've tried to find how to do it as a module, but I'm not a coder with enough skills for that ... or I don't know if I can use hooks to do that ...
    3 points
  5. Thanks @abdus Relating to the topic, there are other code snippets lurking in the Forum, like: Have a different title of a field across multiple templates? Hook to hide inputfield in Admin Custom Field in Page SettingsTab Remove a fieldset tab from specific pages of a template
    3 points
  6. Hi! I actually ended up talking to Ryan this morning via email and he very kindly worked on our issue after hours at his end and fixed the problem. As it turned out, it wasn't specifically an issue with our ProDrafts module and product key. It was a combination of a few things, including beta vs stable versions, some 3rd party modules, and some of our config. Luckily it's just our test server, but it's all part of learning the system too I guess! Cheers, Margaret
    3 points
  7. You'd also want to think about memory usage/limits. If someone uploads a 10000-pixel-wide image and you go to resize it for use in your template you could run out of memory. This was one of the reasons for introducing the client-side image resizing which is linked to the max-width/max-height settings.
    3 points
  8. Actually, that's quite similar to the breadcrumb dropdown I built for our new intranet layout, so I totally agree . I don't think there's a good place to hook into, but making AdminThemeUikit::renderBreadcrumb hookable shouldn't be too expensive. It might be worth adding a feature request in the issue tracker.
    2 points
  9. I think this default behaviour is totally wrong - $config->adminEmail should not be used as the fallback "from" address by WireMail. I opened a LoginRegister issue and core feature request.
    2 points
  10. I'd say that this depends entirely on your use case. For an example, we have a couple of sites with a large amount of pages, where each page potentially holds a very large number of images, and those images tend to be highest possible digital camera quality. If there wasn't a limit in place, the site would get unmanageably large in no time. At the same time we know where and what those images are used for, and for those use cases ~1200px width/height is more than enough. On the other hand if you know that there won't be a massive amount of images or you have a notable amount of disk space to spend, and you really do need images in 2400px+ sizes, then by all means keep the full versions. In most cases I'd argue that a sensible limit makes sense, but obviously some cases – storing images used for print stuff, very large header images, etc. – demand that you set the limit pretty high, or even leave it off. Just thinking out loud, really. Probably nothing there that you didn't already know
    2 points
  11. https://www.baumrock.com/portfolio/individuelles-crm-und-controlling-tool/ I'm happy to share my biggest and most interesting ProcessWire project so far with you It's a 100% custom office-management solution that helps my client to keep track of all their contacts, projects and finance/controlling stuff. Conception was done back in 2016 and the software is productive since begin of this year. My client is very happy with the result and so am I. Some technical insights: Everything is done inside the PW Admin. I'm using the Reno Theme with some custom colors. In the beginning I was not sure if I should stay with the pw admin or build my own admin-framework but now I'm VERY happy that I went with PW Almost all of my custom Process Pages use my RockDatatables module - there are still some limitations but without it, this project would not have been possible For the charts I used Google Charts and chartjs - both play well together with the datatables and make it possible to display filtered data instantly: also my handsontable module was created for this project to have a nice and quick option for matrix data inputs: Lister and ListerPro were no options as i needed much more flexibility regarding data presentation (like colorization, filtering and building sums of selected rows): invoices are highly customisable as well and easy to create. PDFs are created by php and mPDF by the way: all data is dummy data populated via my Module RockDummyData have a nice weekend everybody
    1 point
  12. If anyone's interested, I've forked Ryan's ProcessWireUpgrade module and added the ability for it to detect if github has a tagged release for the latest version of each listed module (except for the PW core repos which will require special handling). If a tagged release entry is found, it then adds an extra link to the table. This is strictly an alpha "proof-of-concept" experiment, but if you are interested my fork of the repo is here - just replace the current version of the module code with my fork and you should be OK. Providing module authors start tagging their releases on github, it will allow you to navigate to the release notes for review before you hit the upgrade link. As you can see, Mike Rockett has already started tagging his releases - and hence his module gets the extra "Release Notes" link. Worthwhile idea?
    1 point
  13. protected function defineOptions() { return array( array( 'name' => 'csv_upload', 'label' => 'CSV upload', 'description' => 'Upload a CSV file.', 'type' => 'file', 'extensions' => 'csv txt', 'overwrite' => true, 'maxFiles' => 1, 'required' => true, ) ); } protected function executeAction($options) { // If there was a file uploaded (Pagefiles object) if(count($options['csv_upload'])) { // Get the file (Pagefile object) $file = $options['csv_upload']->first(); // Parse the CSV data $handle = fopen($file->filename, 'r'); $count = 0; while(($row = fgetcsv($handle)) !== false) { $count++; // Process each $row // ... } fclose($handle); // Delete the uploaded CSV file (or else you will get an error next time you upload) unlink($file->filename); $this->successMessage = "$count CSV rows were processed."; return true; } else { $this->failureMessage = 'Please upload a CSV file'; return false; } }
    1 point
  14. @matjazp Just sent in a pull request for your consideration. I was in need of an admin edit option that would allow me to specify files in the templates/styles/skin subdirectory of a site under development. I therefore added a recursive scan of the templates/ directory to the config options for the root of the editable files. I also noticed that whenever I used the module to edit one of the files (hosted on a linux server) , git would pick up every line of the file as having changed, not just the little edits that had actually been made. It seems that the post of the file through to the back end was converting all the original linux end-of-line characters into Windows end-of-lines. This makes finding and describing edits made by clients very difficult. I therefore added a config option for you to specify what line endings to use on save (Win/Mac/*nix) so the files show no eol differences and git diff shows only what was really changed. Small update to the choice of font-awesome icon too. Thanks for considering!
    1 point
  15. Here's a working example for you: <?php namespace ProcessWire; $showForm = true; if ($input->post->upload) { $tempDir = wire()->files->tempDir('userUploads')->get(); $uploaded = (new WireUpload('uploadedFile')) // same as form field name ->setValidExtensions(['txt', 'png', 'jpg', 'pdf']) ->setMaxFiles(1) // remove this to allow multiple files ->setMaxFileSize(10 * pow(2, 20))// 10MB ->setDestinationPath($tempDir) ->execute(); // $page = $pages->get(1234); foreach ($uploaded as $file) { $filePath = $tempDir . $file; // $page->files->add($filePath); echo $filePath . "<br>"; } // $page->save('files'); if (count($uploaded)) { echo sprintf("Uploaded %d files", count($uploaded)); $showForm = false; } } ?> <?php if ($showForm): ?> <?php // Adding enctype is crucial!! ?> <form method="POST" action="./" enctype="multipart/form-data"> <label for="uploadedFile"> Upload: <?php // suffix name with [] and add multiple attribute if you allow multiple files ?> <input type="file" name="uploadedFile[]" id="uploadedFile" multiple> </label> <div> <button name="upload" value="1">Upload</button> </div> </form> <?php endif; ?>
    1 point
  16. It's uninstalled by default, you need to install it under Modules > Core
    1 point
  17. Just realized that I forgot to increment the version, I appreciate if you could sort that out
    1 point
  18. Done. https://github.com/horst-n/WireMailSmtp/pull/9/ Here's how it looks now:
    1 point
  19. Where do you need this "label" to be visible? You could try adding a title field to the role template. This way, when you drill down the admin page-tree, you will see the title instead of the name.
    1 point
  20. Hi, The module is about dealing with users of the system. Building a list of "leads" is not the same thing, so this is not the module to solve it. There can be use cases when the set of users overlap the set of leads but that should be handled differently and is a more complex issue. SimpleForms is the simplest way to collect your leads, I do not think switching to LoginRegister is worth the effort.
    1 point
  21. There's native `Fieldset in Tab` for creating editor tabs, but sometimes it could make more sense to put a field that's not directly related to `Content` into `Settings` or `Children` tab (such as for body class or some toggles that I see being used often). You can use the hook below to move fields between the tabs. // site/ready.php wire()->addHookAfter('ProcessPageEdit::buildForm', function (HookEvent $e) { // make sure we're editing a page and not a user if ($e->process != 'ProcessPageEdit') return; // RESTRICT BY TEMPLATE // $page = $e->object->getPage(); // if ($page->template != 'home') return; // RESTRICT BY ROLE // $user = $e->user; // if (!$user->hasRole('editor')) return; $form = $e->return; $contentTab = $form->children->get('id=ProcessPageEditContent'); $settingsTab = $form->children->get('id=ProcessPageEditSettings'); // $childrenTab = $form->children->get('id=ProcessPageEditChildren'); // if page template is set noSettings = true, $settings will not exist if (!$settingsTab) return; // MOVE TITLE FIELD TO SETTINGS TAB $title = $contentTab->get('title'); if (!$title) return; $contentTab->remove('title'); $settingsTab->prepend($title); });
    1 point
  22. Thanks for noticing that - it should be fixed in the latest version. Because there are settings for this module on every page (Settings tab), saving the page was saving the settings. Now I check to see if there are any changes before saving. Please let me know if it works as expected for you.
    1 point
  23. Ryan, Thanks again for making Login/Register/Profile available. It looks like it will serve 99% of my needs with one exception. What are the chances that the Login/Register/Profile module will support images soon? I've been playing with the module and want to use it on a community project that I've had in mind for a while, but just noticed your disclaimer: "You should stick to using simple text-based fields for now. File/image fields, repeaters, rich text editors and combination fields fields are not supported on the front-end at present." I'm willing to be a guinea pig for testing if that helps facilitate the functionality.
    1 point
  24. Good point. I left page template optional (but it's really encouraged), but I didn't consider user pages at all. Updated the OP.
    1 point
  25. Cool stuff! But in the example you would definitely want that template check at the top of the hook (or check the current process with $this->process) or you will get an error when creating or editing a user (no Settings tab exists).
    1 point
  26. I think this could be said of any CMS really. I have found though that the barrier to entry with PW is low, and the learning curve is steady. It's not like you get to a point then get totally stuck like I've experienced in the past. I've found knowledge of one thing leads nicely to the next. This is what keeps me interested just keep dangling that carrot.
    1 point
  27. I can add other hotkeys too if there's a need (but may take some time)
    1 point
  28. Note: https://github.com/rolandtoth/AdminOnSteroids/wiki#hotkeys AdminOnSteroids has some of this module's functionality if you need something that works with 3.+
    1 point
  29. Page actions modules look like custom made, and this one seems suspicious. Try disabling/uninstalling it. Edit: If it doesn't work, search the /site/ directory for `addHook` and look for Page::save / Page::saved / Page::saveReady
    1 point
  30. There are modules you can use: https://modules.processwire.com/modules/schedule-pages/ https://modules.processwire.com/modules/publish-date/
    1 point
  31. Howdy @adrian I'm wondering why I get lots of "Saved module 'PageProtector' config data" entries in /site/assets/logs/modules.txt as I do not remember saving the module settings so frequently. If it is not my "fault", can you please take a look at how to "get rid of them" should they be generated "by mistake".
    1 point
  32. Just in case you still have a minute, have you tried deleting the FileCompiler cache and clearing your PW cookies in the browser?
    1 point
  33. https://www.baumrock.com/portfolio/event-voting-tool-social-impact-award/ Another nice little Showcase of what can quickly be done with Processwire I sponsored this voting tool for the Austrian Social Impact Award ceremony (https://socialimpactaward.net/) helping them to pick the winner of the audience voting. The site is based on the default UIKIT theme (obviously) and i basically just placed the logo + changed the colors. The site structure is also very simple, having only one parent to store all teams, one parent to store all votes and one page to show the results (to the admins): The Projects-Template stores some informations of the project and the vote-count: All the votings are single pages as well having only one checkbox, ensuring that every code can only vote once (every visitor got one code at the entrance): Votes are created via Tracy Console as easy as that: The hook that creates the passwords is also simple: /** * create unique code for voting */ $wire->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments(0); if($page->template != 'vote') return; if(!$page->title) { $rand = ''; while(!$rand OR pages("title=$rand")->count() > 0) $rand = randomPassword(); $page->title = $page->name = $rand; } }); And finally the check if the vote for this code is already done (inside the vote-template). the whole vote-template is as simple as that (thanks to the awesomeness of markup regions and functionsapi): <?php namespace ProcessWire; // handle votes (url segments) if($id = $sanitizer->int($input->urlSegment1)) { // if voting is locked redirect to thankyou message if($page->votingdone) $session->redirect($page->url); // else set voting $team = pages($id); if($team->id) { // increase voting for this team $team->setAndSave('votes', $team->votes+1); // lock this votings page $page->setAndSave('votingdone', 1); } } ?> <?php // if voting is done show thank you and lock page if($page->votingdone): ?> <region id="main"> <div class="uk-card uk-card-primary uk-card-body uk-width-1-1 uk-margin-small-top uk-text-center uk-border-rounded"> <h3 class="uk-card-title">Danke für Ihre Teilnahme!</h3> </div> </region> <?php return; endif; ?> <region id="main"> <div class="uk-text-center uk-margin-top"><?= $page->parent->body ?></div> <?php foreach(pages('template=team, sort=random') as $team): ?> <div class="uk-card uk-card-default uk-card-body uk-width-1-1 uk-margin-small-top uk-border-rounded"> <h3 class="uk-card-title uk-text-center"><?= $team->title ?></h3> <ul uk-accordion="collapsible: true"> <li> <p class="uk-accordion-title uk-text-center"><span uk-icon="icon: chevron-down"></span> Beschreibung anzeigen</p> <div class="uk-accordion-content"> <?= $team->body ?> </div> </li> </ul> <a href="<?= $team->id ?>" class="uk-button uk-button-large uk-button-primary uk-width-1-1 uk-border-rounded">Für dieses Projekt abstimmen</a> </div> <?php endforeach; ?> </region> I'm still impressed by ProcessWire and how much can be achieved with how little effort
    1 point
  34. Hi @Robin S - I have fixed both those bugs you reported - thanks for that. As far as using a File field - actions can use any PW code, so this is certainly possible. You could make use of a FieldtypeFile field using the same approach that Ryan uses in his ImportPagesCSV module, or you could use a Markup field and add a "manual" <input type="file" /> field - whatever you prefer really. I don't think the main code in AdminActions needs any adjustments to support these, but let me know if there is anything I can do.
    1 point
  35. GitHub issue opened here: https://github.com/processwire/processwire-issues/issues/399
    1 point
  36. No, it doesn't search as a phrase but it does require all of the words to be present in the field, and does not match partial words. So if $q = "red dog" it will match "I have a dog and she loves red frisbees" but it won't match "I have three red dogs". When using the %= operator with multiple words, you will need to explode on spaces and foreach: $q = preg_replace("/\s+/", ' ', trim($q)); // trim and replace multiple spaces with single space $q_words = explode(' ', $q); $selector = "template=product, limit=10"; foreach($q_words as $q_word) { $selector .= ", title|subtitle|summary|body|product_isbn|authors.authors_name%=$q_word"; }
    1 point
  37. I've now merged FlorianA's patch into the allow-blanks branch. Please test and let me know if it works for you.
    1 point
  38. Never underestimate the importance of word separation. It's the difference in readability between "pen-is-broken" and "penisbroken". Beyond the potential misunderstandings is raw readability both to users and search engines. While I have a readability preference for underscores, my understanding is that hyphens are the best balance when all factors are taken into consideration. Lastly, this may be obvious, but what gets populated in that name box is only an auto-generated suggestion. After populating the title, one can go modify the name as they see fit (which I often do), before saving the page.
    1 point
×
×
  • Create New...