Leaderboard
Popular Content
Showing content with the highest reputation on 11/16/2017 in all areas
-
Part 1 of a 2 part Module & Service Reveal. I'm currently working on a new module: ModuleReleaseNotes that was inspired by the work I originally did on making Ryan's ProcessWireUpgrades module "release" aware. In the end, I decided to ditch the approach I was originally taking and instead work on a module that hooked in to the UpgradeConfirmation dialog and the module edit page. Aims My aims for this module are as follows... Make discovery of a module's changes prior to an upgrade a trivial task. Make breaking changes very obvious. Make reading of a module's support documentation post-install a trivial task. Make module authors start to think about how they can improve the change discovery process for their modules. Make sure the display of information from the module support files/commit messages doesn't introduce a vulnerability. Looking at these in turn... Making discovery of a module's changes prior to upgrade a trivial task. This is done by adding a "What's changed section" to the upgrade confirmation dialog. This section takes a best-effort approach to showing what's changed between the installed version and the updated version that's available via the module repository. At present, it is only able to talk to github-hosted repositories in order to ask them for the release notes, the changelog file (if present) and a list of commits between the git tag that matches the installed version and the tag matching the latest version. It will display the Release Notes (if the author is using the feature), else it will display the commits between the tags (if tagging is used by the module author) else it will show the changelog file (if present) else it will show the latest N commits on the master branch (N, of course, being configurable to your liking.) An example of the Github Release Notes pulled in for you, taken from Mike Rockett's TextformatterTypographer Module... An example of a tag-to-tag commit list from the same module... An example of a changelog - formatted to show just the changes (formatting styles will change)... Finally, an example of a fallback list of commits - sorry Adrian ... Making breaking changes obvious. This is currently done by searching for a set of configurable search strings. Later versions may be able to support breaking change detection via use of Semantic Versioning - but this may require some way of signalling the use of this versioning standard on a module-by-module basis. For now, then, you can customise the default set of change markers. Here I have added my own alias to the list of breaking change markers and the changes section of the changelog is styled accordingly (these will be improved)... Make reading of a module's support documentation, post-install, a trivial task. This is done by making some of the support files (like the README, CHANGELOG and LICENSE files) readable from the module's information/settings screen. There is an option to control the initial open/closed state of this section... Here is Tracy's README file from within the module settings page... Make module authors start to think about how they can improve the change discovery process for their modules. There are notes in each of the sections displayed on the upgrade confirmation page that help authors use each of the features... Make sure display of external information doesn't introduce a vulnerability. This is an ongoing concern, and is the thing that is most likely to delay or prevent this module's release lead to this module's withdrawl should a vulnerability be found. Currently, output is formatted either via Markdown + HTML Purifier (if it was originally a Markdown file) or via htmlspecialchars() if it has come from a plaintext file. If you discover a vulnerability, please get in contact with me via the forum PM system. Ongoing... For now, I've concentrated on integration with GitHub, as most people use that platform to host their code. I know a few people are hosting their repositories with BitBucket (PWFoo comes to mind) and some with GitLab (Mike Rockett?) and I would eventually like to have adaptor implementations for these providers (and perhaps GitKraken) - but for now, GitHub rules and the other hosts are unsupported. Links Github: ModuleReleaseNotes PW Module Repository: Here5 points
-
Edit: Because of the great response to this topic I wrote a guest blogpost: https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/ One of the hidden treasures of processwire seems to be the creation of custom admin pages. Technically speaking those pages are ProcessModules - but i guess that's the reason why so many people out there seem to be afraid of building them... it sounds so hard! You've never created a module for ProcessWire? You have never created a plugin for any other CMS? You have no clue about OOP with all its classes, methods and properties? No problem! I'll show you how simple you can start: <?php class CustomAdminPage extends Process { public static function getModuleinfo() { return [ 'title' => 'Custom Admin Page Example', 'summary' => 'Minimalistic ProcessModule to show that nobody has to be afraid of building custom admin pages.', 'href' => 'https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/', 'author' => 'Bernhard Baumrock, baumrock.com', 'version' => 1, // page that you want created to execute this module 'page' => [ 'name' => 'customadmin', // your page will be online at /youradmin/setup/customadmin/ 'parent' => 'setup', 'title' => 'Custom Admin Page Example' ], ]; } public function ___execute() { return 'This is the most simple Admin-Page you have ever seen :)'; } } Now save this file as CustomAdminPage.module and place it in your /site/modules folder. After a refresh it will show your module in the modules manager of your site where you can install it: After installation you already have your first very own admin page! Congratulations! Was not too hard, was it? It's as simple as that! Now lets add some more custom HTML. And to show you another nice feature we will add this code to a separate method called executeDemo(). And because everything is so simple we will also add some javascript to this page public function ___executeDemo() { $out = ''; $out .= '<h1>H1 has some special css styling in the admin, thats why it seems to have no effect</h1>'; $out .= '<h2>H2 looks different ;)</h2>'; $out .= '<h3>...and so does H3</h3>'; $out .= '<button onclick="myFunction()">Click me</button>'; $out .= '<script>function myFunction() { alert("this is a demo javascript"); }</script>'; return $out; return ''; } Now thanks to ProcessWire-magic your page will already have its own URL: Just append /demo to your url and see what you get: And of course don't forget to click the button Ok, now that code looks a bit hacky, right? Inputfields and especially InputfieldMarkup for the win! We add another method with some advanced code. To use inputfields we need a form that holds all those inputfields and that makes it possible to handle user input lateron. See somas great tutorial about forms here for a quickstart and more details: public function ___executeAdvanced() { $out = '<h2>A more complex Example</h2>'; $form = wire()->modules->get('InputfieldForm'); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Markup Test 1'; $field->value = '<h1>h1</h1><h2>h2</h2><h3>h3</h3><h4>h4</h4>'; $form->add($field); $out .= $form->render(); return $out; } Ok, it get's boring Let's do something more fun and add a chart in a second field and change the fields to 50% screen width (I'm sure you know that already from the GUI template editor)! public function ___executeAdvanced() { $out = '<h2>A more complex Example</h2>'; $form = wire()->modules->get('InputfieldForm'); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Markup Test 1'; $field->value = '<h1>h1</h1><h2>h2</h2><h3>h3</h3><h4>h4</h4>'; $field->columnWidth = 50; $form->add($field); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Chart Sample'; $field->value = '$chart'; //$field->notes = 'Example code taken from here: http://www.chartjs.org/docs/latest/getting-started/usage.html'; $field->columnWidth = 50; $form->add($field); $out .= $form->render(); return $out; } OK, we are almost there... we only need to add the chart library! To keep everything clean we will put the code for the chart in another method. We will make that method PRIVATE to add some security. Our new Method: private function renderChart() { // prepare chart code wire()->config->scripts->add('https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.min.js'); ob_start(); ?> <canvas id="myChart"></canvas> <script> var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'bar', data: { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [{ label: '# of Votes', data: [12, 19, 3, 5, 2, 3], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)', 'rgba(255, 206, 86, 0.2)', 'rgba(75, 192, 192, 0.2)', 'rgba(153, 102, 255, 0.2)', 'rgba(255, 159, 64, 0.2)' ], borderColor: [ 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)' ], borderWidth: 1 }] }, options: { scales: { yAxes: [{ ticks: { beginAtZero:true } }] } } }); </script> <?php return ob_get_clean(); } Now we just need to call $this->renderChart() in the right place! Here is the complete Module: <?php class CustomAdminPage extends Process { public static function getModuleinfo() { return [ 'title' => 'Custom Admin Page Example', 'summary' => 'Minimalistic ProcessModule to show that nobody has to be afraid of building custom admin pages.', 'href' => 'https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/', 'author' => 'Bernhard Baumrock, baumrock.com', 'version' => 1, // page that you want created to execute this module 'page' => [ 'name' => 'customadmin', // your page will be online at /youradmin/setup/customadmin/ 'parent' => 'setup', 'title' => 'Custom Admin Page Example' ], ]; } public function ___execute() { return 'This is the most simple Admin-Page you have ever seen :)'; } public function ___executeDemo() { $out = ''; $out .= '<h1>H1 has some special css styling in the admin, thats why it seems to have no effect</h1>'; $out .= '<h2>H2 looks different ;)</h2>'; $out .= '<h3>...and so does H3</h3>'; $out .= '<button onclick="myFunction()">Click me</button>'; $out .= '<script>function myFunction() { alert("this is a demo javascript"); }</script>'; return $out; return ''; } public function ___executeAdvanced() { $out = '<h2>A more complex Example</h2>'; $form = wire()->modules->get('InputfieldForm'); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Markup Test 1'; $field->value = '<h1>h1</h1><h2>h2</h2><h3>h3</h3><h4>h4</h4>'; $field->columnWidth = 50; $form->add($field); $field = wire()->modules->get('InputfieldMarkup'); $field->label = 'Chart Sample'; $field->value = $this->renderChart(); $field->notes = 'Example code taken from here: http://www.chartjs.org/docs/latest/getting-started/usage.html'; $field->columnWidth = 50; $form->add($field); $out .= $form->render(); return $out; } private function renderChart() { // prepare chart code wire()->config->scripts->add('https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.min.js'); ob_start(); ?> <canvas id="myChart"></canvas> <script> var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'bar', data: { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [{ label: '# of Votes', data: [12, 19, 3, 5, 2, 3], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)', 'rgba(255, 206, 86, 0.2)', 'rgba(75, 192, 192, 0.2)', 'rgba(153, 102, 255, 0.2)', 'rgba(255, 159, 64, 0.2)' ], borderColor: [ 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)' ], borderWidth: 1 }] }, options: { scales: { yAxes: [{ ticks: { beginAtZero:true } }] } } }); </script> <?php return ob_get_clean(); } } I hope you enjoyed reading this and it will open up many new possibilities for you! Updates: permissions: https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/?do=findComment&comment=174746 tutorial on file uploads: https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/?do=findComment&comment=185261 snippet how to use NavJSON: https://processwire.com/talk/topic/17709-how-to-create-custom-admin-pages-aka-processmodules-yes-its-that-simple/?do=findComment&comment=2164124 points
-
This is the first collaborative project that my wife and myself have worked together on. The goal was simple --- Create a public online experience that showed off the "Custom Artisan" jewelry that she has made for years. https://yellowrosecreations.biz The website is built around an e-commerce platform. Through ongoing work with a new client of mine, I had gotten to know about Ecwid as an e-commerce solution that was tied in closely in with Square (a financial services, merchant services aggregator and mobile payment company). My work with Ecwid for the past few months afforded me with the opportunity to get this web project up and online in no time. Let me be clear, while this e-commerce solution works fine, our long term goal is to use Padloper for the online store. That long term goal is more about controlling where our data resides and being able to freely enhance the total shopping experience. I already know that a solution based on ProcessWire will give us the ultimate e-commerce flexibility. The great thing about the ProcessWire platform is that there are numerous tools that enable you to get things done. To my delight, I discovered that using the Hanna Code module allowed me to easily integrate Ecwid (which actually means e-commerce widget) code into a ProcessWire website. I will write a separate article about how that works at a later time. The website makes use of the UnSemantic Responsive CSS grid with Zurb Foundation components added/mixed in. This is an unconventional combination to use, but it works for us. On the ProcessWire side, there were a few critical modules that contributed to gettng this website online: TextformatterHannaCode ProcessDatabaseBackups CronjobDatabaseBackup AdminLinksInFrontend ProCache FormBuilder PrevNextTabs WireMailSmtp ImportPagesCSV ProcessEmailToPage MarkupProcesswirePhotoswipe Hanna Code snippets were used throughout to populate the Ecwid Online Shopping Bag, the Ecwid Main Online Store, different Ecwid Product Category Listings, the green Foundation Buttons in the website sidebar and some other webiste features. ProcessWire Page Table and Page Reference fields were instrumental in generating the product descriptions that are used on the Ecwid Online Store. Each jewelry item has it's own page within ProcessWire that can be later used with the Padloper e-commerce solution. On the backend side, we were able to create a repository page that keeps track of each product, SKU, pricing and their current disposition status related to the Online Store. This has been a fun and fascinating project to work on. It took us a few weeks to get everything worked out. As I have said before, ProcessWire makes projects of this type possible because you are not limited by the front-end framework you can use. Even when there are not dedicated modules to incorporate a feature that you like, this platform and it's openness allows you to do things that are impossible to do on other systems. It just takes a little ingenuity, planning and time on your part to make things work.2 points
-
It's always been an issue to some degree: I have actually moved all my modules to string version numbers so that I can do 1.2.13 etc. I am trying to be more diligent with using numbers that are somewhat semantic at least.2 points
-
Took it one step further, and with a bit of hackery on the templates and the module file, got my sidebar in and various other tweaks. Not properly responsive, breaks some theme settings, the breadcrumbs are ropey, the sidebar is not full height (or fixed), less needs serious refactoring. Not sure why the masthead is a fixed height, but anyway, this is what I want my admin theme to look like I personally think you don't need theme settings for layout, for me it just makes the admin theme harder to tweak. Why not just have a theme that does one thing? I don't want to use jquery layout, or any fly in anythings, other than the sidebar on mobile. It doesn't need to be overcomplicated. Would be awesome to get something like this working properly so it could be a proper admin theme. I'm a bit stuck on the php side of things, I can handle the less (need more practice with uikit though for sure). I'm more than willing to team up with someone if they like the idea/look of this.2 points
-
2 points
-
Apart from what I've already mentioned, in response to DaveP, I'm running on PHP 7.1 I noticed over in another thread here: https://processwire.com/talk/topic/17707-php-in-2017-rasmus-lerdorf-wearedevelopers-conference-2017/ The creator of PHP mentioned in the video that there's a big difference in performance between PHP 5.x and 7.x so that may be having some impact on performance too.2 points
-
Thanks for the encouraging feedback folks! @Robin S There's an option to turn off the timed author-auto-shock-via-email(tm) feature which should stop it telling you off too much Actually, the module gives you some options here - including doing nothing more than using git to commit your code - which we all do already. But I think I take your point; I guess the module could induce some of our users to nag us about keeping the upgrade process free of yellow notes. Regarding guidance, I think it partially comes down to your own style working and issuing releases. For example, I commit lots of small changes - which makes my commit log pretty long and difficult to review. In my case, forcing myself to either keep a concise changelog file or to git tag my releases and then use the github release-notes feature, can be better for my module users. Even if I didn't want to start using Github's Release Notes or keeping a changelog, simply learning to add a git tag on each version increment is an improvement, as it allows the length of the commit list to be automatically limited to what is relevant. For someone like Ryan, who tends to commit larger changes at lower frequencies, just using the git-tags feature to limit the list of commits to those between your installed version and the newest version is probably all that is needed.2 points
-
DPS looks interesting and I will check that out. Though it still seems like work will be duplicated if the client also needs to deliver the content via a website. That is a great suggestion! I had completely overlooked EPUB format. I don't know a lot but an EPUB is essentially HTML right? So potentially quite easy to go from static HTML files (could even grab them from ProCache?) to EPUB. I think Calibre can do it but there are perhaps more professional tools. This also looks promising: https://epub.press/2 points
-
Thanks for all the replies! In my scenario (which I'm investigating mostly out of curiosity as the client is not pressing me for a solution to this) there would not be a budget for an entirely new app development. The desire is to present an existing website via an app wrapper. It seems like there are a bunch of SaaS providers who offer this (the ones I found all looked kinda dodgy) but with the catches being: 1. An internet connection is required, because the app user is essentially just browsing your live website inside a wrapper. What I'm looking for is something that could crawl a website and then save the content for offline browsing. For Android there is this: Offline Browser - which looks pretty good, but it's for general-purpose browsing. I'd like something that can be packaged up and distributed for just for one website. 2. You have to pay an ongoing subscription for the provider to do basically nothing. 3. If the provider goes bust (and several I looked at did not inspire confidence) your app goes bust too. Thanks, will look into that. Seems like development would be faster than some other options, but I think it would still be a fairly costly addon for the client to pay my development time. In this project there were a lot of images so would definitely go beyond 50mb. Also still not sure if the service worker can crawl the entire site without users actually browsing to those pages. Cool idea, but in my example the end users are forestry roading engineers working in different locations across the country so probably not viable to give each their own Raspberry Pi. Would also need a pretty rugged housing. That's not the objective - it's actually sort of the opposite of the objective. The source format is PDF but the problem is that the PDF layout is for a large-format printed book. It does not adapt well to small screens. Also I think the client is enthusiastic about the prospect of making easy document edits via the PW backend. I think there is a gap in the market here (anyone looking for a startup idea?). Off the top of my head I can think of half a dozen previous projects where I think the client would have liked to be able to deliver basic static website content offline to mobile devices. Worldwide there would be a big audience for this. What's needed is the same sort of native wrapper idea the SaaS providers are selling, but with the crawl-and-store features of the Offline Browser app. And sold as a one-off purchase because I think buyers know there is not a lot of ongoing service being provided that justifies a subscription, and would like the confidence that the app keeps working if the provider goes bust. It sucks that Apple are so restricting about the delivery of iOS apps, but I suppose there are security concerns and a lot a malicious agents out there.2 points
-
This module allows you and your site editors to protect a page (and optionally its children, grandchildren etc) from guest access directly from the page's Settings tab. You can also limit access to certain roles. http://modules.processwire.com/modules/page-protector/ https://github.com/adrianbj/PageProtector It makes it very easy for editors to set up various password protected areas on their site, or to simply protect a new page or section while they are still working on it. Ability for your site editors to control the user access to pages directly from Settings tab of each page Include whether to protect all children of this page or not Optionally allow access to only specified roles Option to protect all hidden pages (and optionally their children) Ability to change the message on the login page to make it specific to this page Option to have login form and prohibited message injected into a custom template Access to the "Protect this Page" settings panel is controlled by the "page-edit-protected" permission Table in the module config settings that lists the details all of the protected pages Shortcut to protect entire site with one click In addition to the admin interface, you can also set protection settings via the API: // all optional, except "page_protected", which must be set to true/false // if setting it to false, the other options are not relevant $options = array( "page_protected" => true, "children_protected" => true, "allowed_roles" => array("role1", "role2"), "message_override" => "My custom login message", "prohibited_message" => "My custom prohibited access message" ); $page->protect($options); As alway, I would love any feedback / suggestions for improvements. Hope you find it useful! Page Protection Settings (settings tab for each page) Module Config Settings1 point
-
Module: Auto Smush https://github.com/matjazpotocnik/AutoSmush Optimize/compress images. In Automatic mode images that are uploaded can be automatically optimized. Variations of images that are created on resize/crop and admin thumbnails can also be automatically optimized. In Manual mode "Optimize image" link/button will be present. This allows manual optimization of the individual image or variation. In Bulk mode all images, all variations or both can be optimized in one click. Will process images sitewide. Two optimization "engines" are avaialable. reShmush.it is a free (at the moment) tool that provides an online way to optimize images. This tool is based on several well-known algorithms such as pngquant, jpegoptim, optipng. Image is uploaded to the reSmush.it web server, then optimized image is downloaded. There is a 5 MB file upload limit and no limit on number of uploaded images. "Local tools" is set of executables on the server for optimizing images: optipng, pngquant, pngcrush, pngout, advpng, gifsicle, jpegoptim, jpegtran. Binaries for Windows are provided with this module in windows_binaries folder, copy them somewhere on the PATH environment variable eg. to C:\Windows. Similar modules: JpegOptimImage by Jonathan Dart: https://processwire.com/talk/topic/6667-jpegoptimimage/ TinyPNG Image Compression by Roope: https://github.com/BlowbackDesign/TinyPNG ProcessImageMinimize by conclurer: https://processwire.com/talk/topic/5404-processimageminimize-image-compression-service-commercial/ Forum discusion: https://processwire.com/talk/topic/12111-crowdfunded-tinypng-integration-module/ Module created by Roland Toth (@tpr).1 point
-
This little tutorial is about how to change the text of the table headers of a page table field: This is what it looks like before: The text for the table headers comes from the field labels. Now we want to change this a little bit: As you can see I have changed 3 values of the table header: Beginn (Datum) -> Start Beginn (Zeit) -> Beginn Ende (Zeit) -> Ende Here is the hook to make this working. I use a "InputfieldPageTable::render" hook. This code should be placed inside init.php not ready.php $this->addHookAfter('InputfieldPageTable::render', function($event) { $id = $this->input->get('id'); $page = wire('pages')->get('id='.$id); $table = $event->object; $content = $event->return;//put the output into a variable for manipulation later on if($table->name == 'mypagetablefield'){ //only on this pagetable field - rename it to the name of your field //create an array of all fields where you want to change the header text $fieldsarray = array( //use name of the field as key and the new header text as value ($key => $value) 'field1' => __('Text 1'),//rename field1 to your field name and Text 1 to your table header text of field1 'field2' => __('Text 2')//rename field2 to your field name and Text 2 to your table header text of field2 ); $templateID = $page->template->childTemplates[0];//array of children templates IDs - in this case key 0 indicates the first (and only) template; foreach($fieldsarray as $key=>$value) { $label = wire('templates')->get($templateID)->fields->getFieldContext($key)->label;//get labels from template context $content = str_replace($label, $value, $content);//manipulate the output } $event->return = $content;//output the manipulated content } }); I know using str_replace is not the most elegant solution, but I havent found another possibility to achive this. $templateID is used to get the labels from template context. In this example I manipulate 2 field labels (labels of field1 and field2). You have to adapt it to your needs The str_replace line is for the manipulation. If someone has better and more elegant solution please post it here. There is also a problem if the page table is updated via Ajax. If so they headers return to the default value: Maybe a hook with "InputfieldPageTableAjax::checkAjax" would be also necessary. So use with caution at the moment. Edit: After removing this line from the code and putting the code into init.php it works also after updating via Ajax: if($this->process != 'ProcessPageEdit') return; //this was not a good idea to use It seems that if the page table is updated via Ajax than the process is no longer in "ProcessPageEdit" mode, so it will force the hook to not run. Removing this line from the code solves the problem. Now its working after Ajax update without any problems. Also a big thanks to @Robin S for helping me to find a working solution.1 point
-
A very simple textformatter that was inspired by Diogo's RemoveHeight textformatter. This one strips the height from any images and either adds a custom class or adds a max-width:100% as an embedded style. Github: https://github.com/netcarver/TextformatterFluidImages PW Repo: here.1 point
-
The inputfield could be approached a similar way to Profields Table, which does support large amounts of data through limiting and pagination. It was the introduction of pagination within Table that prompted my GitHub request. But although an inputfield solution is important it is the API side that is of greater importance. Currently you cannot do anything with the value of a Page Reference field without loading all the pages into memory. So if you have a Page Reference field with 2000 items and you do... $item = $page->my_page_reference->first(); ...or... $item = $page->my_page_reference->findOne("name=foo"); ...then boom, you have 2000 pages loaded to memory. It's not like $pages->find() or $page->children() where you can be selective or limit what is loaded. Compare with $page->children(): parent-child is one kind of basic relationship between pages. Page Reference is the other kind of basic relationship between pages. Both of these relationships should be able to scale up, but currently only parent-child does. This discussion probably warrants it's own topic.1 point
-
1 point
-
I haven't seen any issues and it should be fine, because it uses PHP's version_compare() which support comparison of integer and string version numbers https://github.com/processwire/processwire/blob/57b297fd1d828961b20ef29782012f75957d6886/wire/core/Modules.php#L4023 http://php.net/manual/en/function.version-compare.php1 point
-
1 point
-
1 point
-
Netcarver is da man. I want it all and I want it now! Where is the download link.... can not wait1 point
-
Ok sorry about this – i just change the leading zero integer to a string so we'll see if that fixes the download install... I regularly use this module instead of the core image tagging, so that i can have those benefits i listed somewhere, in short, key/value pairs for tags and template context for different tags on a field..1 point
-
Hi @Macrura I'm not able to install SelectizeImageTags in PW 3.0.83. Edit: I can install it if I download and manually copy the directory to /site/modules/ This came up a while back... ...were you able to get to the bottom of what was causing it? Also, if I am able to install the module is it still working given the changes to image tagging in the core? I remember you discussing this with Ryan when the core changes were made and just wondering where things stand.1 point
-
Are you able to upgrade your ProcessWire install? The reason I asked is that @ryan has upgraded things related to roles. https://processwire.com/blog/posts/processwire-3.0.81-upgrades-the-role-editor/ You may want to check this blog entry and see if this will make your permissions problem easier to work with?1 point
-
hm.. ok i get the point when we are talking about the pagefield in general i agree that it can be limited at some point. i connected it to my datatables module to get a filterable, paginated list of selectable options: but in this case i'm only browsing many pages... i've never had the need to reference a lot of pages in a pagefield. can you give me some examples when you needed this @Robin S ?1 point
-
adrian admin action module is great module. thanks1 point
-
1 point
-
Thanks to a request from @Rudy this module now supports "Allowed Roles". This is basically the same as the option in the Page Protector module, but I thought it might be nice here as well. It allows you to limit access when in Protected Mode to a defined list of roles.1 point
-
Just to elaborate a bit more on @bernhard's suggestion, you could hook into the Inputfield::render method and draw some other stuff you need right there inside the inputfield (for the check all/none functionality). I think a good example is in HelperFieldLinks code. Here is also an example on how you could add also the necessary Javascript. @Robin S Pagination in Page Table would be awesome.1 point
-
The selectable pages for a Page Reference field can come from anywhere in the tree - this could be hugely nested and several levels of parents may not be included in the selectable pages. So I don't think it would be possible to reliably and accurately display the tree structure for a list of checkboxes. Pagination is not supported in any type of Page Reference inputfield or in the value that is returned by a Page Reference field. It would be fantastic if it was, because the current state of affairs limits the extent to which Page Reference fields can scale up. It's one of the big limiting factors for PW in my opinion. There is an open GitHub request that you could add support to if you like. The way you are using the Page Reference field is not typical I think so perhaps not likely to become supported in the core. More typical would be to use a Page Reference field on the website pages to select a call-to-action page. You could possibly add Connect Page Fields to have the relationship work both ways and get an overview from the call-to-action page. Note also that you can use a custom label format for your inputfield to include the name of the parent page(s) if you want to get a sense of how nested the selectable pages are. Using a hook to set the label would give you greater control. Lastly, it's not outside the realm of possibility to create your own custom inputfield, using InputfieldCheckboxes as a starting point.1 point
-
I forgot to mention that the support file list is not limit to a single readme file. If your module has more than one, they can all be listed and read. This might prove useful for people looking for a self-hosted documenting solution. As an example, here is a screenshot of the readme files from the module itself... Which allows the documentation to be split.1 point
-
1 point
-
of course it it possible i would recommend you to stay inside the pw backend and adapt it to your needs rather than building a frontend on your own. it's really versatile and easy to use once you get the basic concepts of inputfields:1 point
-
You can add the random repeater to the $events array and shuffle it after that. $events->append($cta); $events->shuffle(); Sorry, I just saw that you are ordering the events. So this will not work. In this case I think using insertAfter() is a good solution.1 point
-
Nice site. Funny coincidence but the day before your post I picked up a nice bottle of Cloudy Bay Pelorus here in Sydney.1 point
-
Thanks flydev! I pasted your code into my template, and I got the attachment in the email! I owe you a beer. I've been slowly reading the php documentation on file uploading, to try to understand the theory behind all this stuff, so I can better understand the tips you guys are giving me. Thanks again!1 point
-
Sometimes you want to add a specific markup to the values inside a pagetable field. Fe. you want to add a FontAwesome icon in front of the value or you want to add a background-color. In this little tutorial I want to show you how you can do that with only a view lines of code. In the following example I will add the background color red to a specific field inside the page table. This is what i looks like at default: After the manipulation it will looks like this: You can see the difference in the second field of the pagetable. This manipulation makes not really sense and it is only to show you what can be done. You can manipulate it also in other ways. Fe to add different colors to different status of orders and so on. To achive this we use the following type of hook: Fieldtype::markupValue (read more at https://processwire.com/api/ref/fieldtype/markup-value/) In this case we put the code inside the init.php and not in the ready.php. The reason for this is, that if the page table will be updated via Ajax, the default values will be displayed again if the code is in ready.php. So here we go: $this->addHookAfter('Fieldtype::markupValue', function($event) { $page = $event->arguments(0); $field = $event->arguments(1); $value = $event->arguments(2); if($field->name == 'nameofthefield' && $page->template->name == 'childrentemplatename') { $event->return = '<span style="background:red;color:#fff;">'.$value.'</span>'; } }); First we define all the variables needed for the manipulation ($page, $field and $value). $value returns the formatted value of the field. If you need the unformatted value (fe. if it is a date field and you want the timestamp) you get the unformatted value by using this line of code: $value = $page->getUnformatted($field->name); We restrict it to a special field of the pagetable called "nameofthefield" - rename it to the name of your field where you want the manipulation to take place. So this field of the pagetable is a field of a child template. In this case the child template is called "childrentemplatename". You have to rename it to your child template name. Only to clearify: each field inside the pagetable is part of a child page. "$event->return" returns the output of the field (usually the value). In this example the value of the field should be between two <span> elements with a special CSS styling to add a red background and turn the color of black to white. Here is a usecase where I use this technique: You can see that after the end date there is no time (in opposition to the start date). Instead of the time the text "no specific endtime" is displayed. This is because this event has no specific end time (it is open end). Only to mention: The editor can choose if the event is all day long or starts and ends on specific date and time or it is open end. Thats all and happy coding with your own manipulations!1 point
-
Ok, so there is the new version out now which includes a gallery type like the ones in the medium articles. The whole module has been rewritten and I changed the way the galleries are rendered. Instead of weird template files the galleries are now modules which extend the MarkupPwpswpGallery module. Have a look at the readme for some more info. Everything should work just fine when updating despite the code changes. I build a gallery module which should ensure compatibility in case anyone was using her/his own template file. This is the new gallery type „Petersburger Hängung“ The inspiration for that type: https://github.com/SiteMarina/guggenheim The linear partition problem: http://www8.cs.umu.se/kurser/TDBAfl/VT06/algorithms/BOOK/BOOK2/NODE45.HTM https://github.com/crispymtn/linear-partition/blob/master/linear_partition.coffee#L11 (coffee script) Yet, I implemented a simplier and I guess faster algorithm: https://stackoverflow.com/a/6670011/3004669 Maybe I will implement the original algorithm, too, at some point. ...1 point
-
yeah, i was just starting to write a reply here, then dave was first and then i decided to start a new topic, because we got offtopic here and i'm sure it's valuable information for others as well. here is the tutorial:1 point
-
Generally I agree with @Robin S's comments to you about inheritance of roles - that should usually take care of things without the need to edit template's access settings. It sounds like in your case inheriting everything from the home page template down will do what you want. However, just in case you do ever need to make lots of change to multiple templates, this can help - it's from the AdminActions module.1 point
-
Thanks, abdus. Looks like this module may be just the trick. My favourite part?1 point
-
Just stumbled across this very old topic while looking for something else and thought I should mention the Admin Restrict Branch module in case others come across this.1 point