Leaderboard
Popular Content
Showing content with the highest reputation on 06/08/2014 in all areas
-
Hi everyone! I'd like to introduce PassiveCron - a module, which allows developers to schedule cronjobs - to you. This will be Conclurer's second Pro Module, following ProcessImageMinimize / minimize.pw. PassiveCron is available now as a beta version. What is it going to do? Have you ever been in a situation, in which ProcessWire ran out of PHP's max_execution_time, because you're doing cool tasks like resizing dozens of images using PIM? Or have you noticed site load performance issues when doing a lot of tasks simultaneously? PassiveCron will fix this by giving developers the ability to schedule tasks to future and / or repeating points in time run tasks asynchronously Isn't this exactly the same as LazyCron? No. LazyCron runs your tasks synchronously as your page loads. So running larger tasks will decrease your page's load performance. Instead of this, PassiveCron is able to run those tasks separately from your site loads, thanks to our new web service cron.pw, which will be released together with PassiveCron. How can I use this in my site / module? We will bundle PassiveCron with an easy-to-use API. Let's say you want to call a specific module action tomorrow at 8:00 am: $cron->tomorrow->at('8:00 am')->run('Class', 'Method'); Or do this specific cleanup task, every night at 3:00 am: $cron->every("day")->at("3:00 am")->run("Class", "Method"); Or just run this one large task asynchronously: $cron->run("Class", "Method"); How much will it cost? We are planning to give every ProcessWire site 200 task executions / day for free. For unlimited task executions per site, it'll be around 5€ (pay once, use forever). During the beta period, no payments will be available. Features overview Easy-to-use API for asynchronous task execution Integrable into existing modules for load time improvements No registration at cron.pw needed Pro Cache will be bypassed En- or disable PassiveCron per module Free minimize.pw background tasks Dashboard with reports per task So, what do you think? Is such a module what you need? Can you imagine additional features or do you have wishes for PassiveCron? Please tell us in the comments. Thank you very much!12 points
-
This module adds a preview and zoom button to InputfieldTextarea for live previewing the content after being formatted by the text formatters assigned to that specific field. It's pretty alpha still but it already works. For now I was only playing with the Parsedown formatter, but it should work with every other formatter as well, even with Hanna Code, not sure though, haven't tested it. It's restricted to regular textareas, meaning TinyMCE et al are not supported yet, because they need specific change listeners. Will look into it though. The result is fetched via ajax from a process page, the default style sheet contains some Github-like styles but the style sheet is configurable, see module settings. Github: https://github.com/owzim/ProcessTextareaPreview Open for suggestions3 points
-
Hi folks, I read some posts where people seem to struggle with setting up config values for their modules. Since I am currently working on some boilerplate code for modules I created a helper class that makes handling of config values a peace of cake. on Github: https://github.com/owzim/PWModuleConfigHelper from the README.md Define a default array in your module: protected static $defaultConfig = array( // example with just one option 'prettySetting' => array( // the label for the form 'label' => 'Pretty Setting', // the default value 'value' => 'I am pretty', // optional, defaults to 'InputfieldText' 'inputfieldType' => 'InputfieldText' ), // example with multiple options 'awesomeSetting' => array( // the label for the form 'label' => 'Awesome Setting', // the default value 'value' => 2, // optional, defaults to 'InputfieldRadios' 'inputfieldType' => 'InputfieldRadios', // each key is for the input label, each value will be saved if selected 'options' => array( 'Option 1' => 1, 'Option 2' => 2, 'Option 3' => 3 ), // set any additional attribute to the input field 'attributes' => array( 'optionColumns' => 1 ) ) ); Apply the defaults to your module: public function __construct() { PWModuleConfigHelper::apply($this, self::$defaultConfig); } Render out the form: public static function getPWModuleConfigInputfields(array $data) { return PWModuleConfigHelper::renderForm($data, self::$defaultConfig); } Result: Access any of the config settings from your module: $this->awesomeSetting; Stuff to be aware of If you're using this in your module and you don't want it to clash with other modules using this, you have the following options to include it: use spl_autoload_register to autoload it, so it only gets loaded once only include the class if it has not been loaded yet, via class_exists('PWModuleConfigHelper') Option 1 and 2 require the class not to change (updates etc.) so the following options are more stable: Namespace to class via renaming it, prefixing it with you module's name Namespace it with PHP namespaces I could make a module out of this but this might be overkill Cheers!3 points
-
Well, you could always use has(). Depending on what these pages really are etc. try something like this: $english = $pages->get("template=language, title=English"); if ($page->DMC_select->DMCstats_Language->has($english)) { // do stuff }3 points
-
Little update on the module. You can choose to list folders and or files. If you already had this module installed, be sure you check Hide folders and and save the field settings. Updated the first post in this thread.3 points
-
Marvin, great idea! I think one of the big challenges in offering that kind of service is, that usually things that go into cron, really needs to work. So using your service in own application creates high dependency on your service. While minimize.pw just leaves images uncompressed when not available, having missed cron jobs is a big problem. Other than that - API looks great and yes, very often hoped for a functionality like that. Not sure if I would be willing to tie any business critical jobs to 3rd party service though, instead of building own cron jobs..3 points
-
It's Sunday morning, time to relax and go easy http://www.youtube.com/watch?v=a-YQfkqXg8o3 points
-
this module is really helpful - here are some example use cases that i'm using for: 1.) i made a field at the top of a gallery item template which reminds the user to crop the frames and center the images prior to uploading, as well as some suggestions for naming conventions; so now when someone is adding an item they see those instructions right at the top of the editor; if there is a particular problem with any item in the gallery, i could as the superadmin go to that item and make a further note that this item has a problem.. 2.) i have a template for a class session which is edited using the PageTable module, and when editing that info in the lightbox it can be hard to sometimes remember which class you are editing, so i have a field at the top that says "you are editing a session for {class.title}" so i'm using this for context-aware inline help2 points
-
@pleini - welcome to the forum. to make it easy i would keep the editing all on one screen; then use URL segments to show the different field on each of the virtual pages; but if you need something where the fields are not fixed and you can't predict what the child pages are, you could use the new PageTable module and use the child pages for those; in that case you would still be able to manage the child pages directly on the main page;2 points
-
Not sure if someone already have this, but I just wanted to share it, hoping someone improve it, maybe it's good for a function? It will split long list of pages first top to bottom, then left to right. columns are chosen by you. A | D | G B | E | H C | F | I $columns = 3; // choose number of columns $item = 0; // set counter to zero $num = $pages->count("parent=/branche/"); // use variable for total pages $itemsInColumn = intval($num / $columns); // calculate how many child-pages per column echo "total: ". $num . " | per column: " . $itemsInColumn . "<br />"; // this can be removed if you don't want echo "<div class='left'>"; // left is css: float left foreach($pages->find("parent=/branche/") as $child) { $item ++; // count for each child-page a plus one if($item > $itemsInColumn) { $item = 1; // set back to 1 if total is larger then total in column echo "</div>"; // then end div echo "<div class='left'>"; // and start new float left } echo "<a href='{$child->url}'>{$child->title}</a><br />"; // output my child-page } echo "</div><div class='clear'></div>"; // clear float, end div I know you all must have this, but I am really starting to be afraid asking so I found out by myself1 point
-
Hi apeisa! Thanks for your great feedback. Such good thoughts really help us, creating just the service, developers want and need. I totally agree with you. Minimize.pw was our first step in the ProcessWire ecosystem. We learned a lot from it, especially creating performant web services, that just work. With things like replication and auto-failover, I think we can guarantee a 99% working service. In the coming days, I'll post more information about how the service is going to work. And opposite to ProcessImageMinimize / minimize.pw, PassiveCron / cron.pw will have an extended open beta period before the first final release. We want to help web developers creating the site with everything they imagine, so this is the way to go. On this one, I'm also right there with you. If everything works fine - and I do think so - we have great ideas to follow up for large projects' needs.1 point
-
Oh, that with the reverse order isn't an easy one. Files / Images are uploaded via ajax, and multiple of them asynchron, as Pete already said. On a site where the owner uploads many images at once via zip, I use a bootstrap script to let him rebuild the sortorder by name. The script only get invoked manually by clicking on a link. It is in the template, like the edit-link if a user is logged in and the page is editable: if($page->editable()) { echo "<a class='nav' id='sortimages href='/pwsortimages.php?id={$page->id}'>SortImages</a>"; } Here are the script code I use. If this can be handy for you, until someone comes with a better solution, you can sort by -created or -modified I think. <?php // define userroles that are allowed to work with this script, like: superuser|editor|author $userRolesSelector = 'superuser|editor'; //-------------------------------------------------------------------------------------------// // check if we have got an id $pageId = isset($_GET['id']) && is_numeric($_GET['id']) ? intval($_GET['id']) : false; if(false===$pageId) { header('HTTP/1.1 403 Forbidden'); exit(3); } // bootstrap PW require_once(dirname(__FILE__) . '/index.php'); // check user-account if( ! wire('user')->hasRole($userRolesSelector)) { header('HTTP/1.1 403 Forbidden'); exit(2); } // check if id points to a valid page $p = wire('pages')->get($pageId); if($p->id!=$pageId || !$p->editable()) { header('HTTP/1.1 403 Forbidden'); exit(1); } // now we reset the order for the images / files $p->of(false); $p->images->sort('name'); // -created ?? $p->save(); // and redirect to the page edit screen $url = wire('pages')->get(2)->url . "page/edit/?id=$pageId"; header("location: $url"); exit(0);1 point
-
First, Welcome to ProcessWire. Both of your questions are doable as ProcessWire doesn't impose any particular structure on you. Hopefully some of the more knowledgeable members will give you countless ways of structuring your website. I do things differently that most people, so I would have a page and have the costs, alternatives and features show up on the page as sliders or tabs. Another way would be to have the costs, alternatives and features be child pages to test. You could have individual buttons or links to the child pages on the test page. As I said earlier, there are many ways to proceed with your structure and very smart forum members with innovative web development skills. Good luck.1 point
-
tested latest version: the optimizing is nice and function well. for better translation use new line for the second string and better place the blank after the closing a (see code) 136: $warnings[] = '<a href="?owner='.__CLASS__.'&action=optimize&table='.$t_Name.'">'.$this->_('Optimize').'</a> ' . 137: $this->_('table to reclaim space and reorganize indexes.');1 point
-
@Macrura: you're welcome @owzim: didn't realise that core already takes care of this, so it should pretty much work out of the box. At least that's true for Fieldtype Map Marker and repeaters (just tested). For the record, there's now some very basic output formatting (CSV, basically) for array type values built-in. The need for this came up while outputting values from repeaters, i.e. "here's a list of my friends: {{friends.name }}" (which should now output something like "here's a list of my friends: Smith, Johnson, Williams, Jones").1 point
-
Yes, select the database first from the left menu. Then you can either click the SQL tab, paste in the code and click Go. Or click on the desired table on the left menu, then click the Operations tab, and change the value in the field as mentioned by adrian.1 point
-
Go to the Operations Tab in PMA and there you can adjust the current autoincrement value.1 point
-
Note to self: Never, I said never, accidentily delete the first line ("<?php") of PW's index.php file and save it! Punishment: On next trip to post office collect, fill out and submit form id10t. In triplicate.1 point
-
madalin, PW 2.4 manages themes a little differently. Unfortunately most (all?) of the third party themes have not been updated yet. Here are some instructions on how to get it to work: https://processwire.com/talk/topic/4650-new-processwire-admin-theme-on-dev-branch/?p=53671 However honestly I think you are better off sticking with the default theme at the moment - there is a lot of new functionality in there that the old themes don't support. I also know that there is a second 2.4 specific theme just around the corner, and I am sure more will follow.1 point