Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/27/2016 in all areas

  1. Attention: please don't install this module at the time being! It is not compatible with current PW versions, and it will be some time until I can work in all the changes. Due to a discussion here in the forums, I was inspired to finally have a take on datetime fields and see if I couldn't get them to be searched a little more conveniently. Here's a small module - still in alpha state, but I'd be happy to get some feedback - that allows searching for individual components of a date like year, month, day, hour or even day_of_week or day_of_year, and also returning them. Github repo: DatetimeAdvanced Current version: 0.0.5 Tested in: ProcessWire 2.8 + 3.0 Possible subfields: day month year hour minute second day_of_week day_of_year week_of_year Examples: // Database search: $pagelist = $pages->find("mydatefield.year=2016"); // Filtering PageArray in memory: $maypages = $pagelist->filter("mydatefield.month=5"); // Back to our starting point: $start = date('z'); $end = $start + 7; $sevendays = $pages->find("mydatefield.day_of_year>=$start, mydatefield.day_of_year<$end"); // Nice side effect: subfields are now directly accessible $blogentry = $pages->get('blog-entry-1'); echo $blogentry->title . "(" . $blogentry->publishdate->year . ")"; // New in 0.0.4: shorthand methods echo $blogentry->publishdate->strftime("%Y-%m-%d %H:%M:%S") . PHP_EOL; echo $blogentry->publishdate->date("Y-m-d H:i:s") . PHP_EOL; ToDos for the future: See if there's a possibility to specify ranges more conveniently Check if this can perhaps wiggle its way into the PW core Changes: example for direct subfield access and shorthand methods to strftime() and date() added.
    7 points
  2. Okay, here we go. FieldtypeDatetimeAdvanced with database and PageArray filtering support and descriptive naming. Possible subfields: day month year (4-digit) hour (0..23) minutes seconds day_of_week (0..6, 0 = Sunday) day_of_year (0..365) week_of_year (1..53) Examples: // Database search: $pagelist = $pages->find("mydatefield.year=2016"); // Filtering PageArray in memory: $maypages = $pagelist->filter("mydatefield.month=5"); // Back to our starting point: $start = date('z'); $end = $start + 7; $sevendays = $pages->find("mydatefield.day_of_year>=$start, mydatefield.day_of_year<$end");
    6 points
  3. wireshell 1.0.0 Compatibility: ProcessWire 3.x Prepares wireshell for ProcessWire 3.x, adds namespace support, only supports ProcessWire 3.x Updates Github Repository: github.com/processwire/processwire Improves module:upgrade command, if no argument is provided it just checks for upgrades Extends new command, adds option --src=path/to/source to be able to use a pre-downloaded tgz/zip/folder Extends status command, only shows database password if --pass option is provided, shows if an upgrade is available Updates upgrade command, removes options dev and devns
    6 points
  4. As I've been pondering that same task a few times before, I've drawn up a quick&dirty proof-of-concept module that extends PW's regular FieldtypeDatetime, adding (database) search functionality by using date_format. It's lacking sanitizing and not really thought through all the way, but I'd love to get some thoughts on whether this might be worthwhile to pursue. <?php /** * Advanced Datetime Field * * Allows searching for datetime fields by passing a format string * to MySQL's format_date function as a subfield (only one format option * and without the % sign). * * A list of all format strings can be found at * http://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_date-format * * Examples: * $pages->find("my_date_field.e=27") * // Searches for all pages having the 27th in my_date_field * * $pages->find("my_date_field.Y=2016") * // Searches for pages with year 2016 in my_date_field * * $start = date('z') + 1; // PHP starts at 0, MySQL at 1 * $end = $start + 6; * $pages->find("my_date_field.j>=$start, my_date_field.j<$end") * // All pages in the seven day period starting today **/ class FieldtypeDatetimeAdvanced extends FieldtypeDatetime implements Module { public static function getModuleInfo() { return array( "title" => "Advanced Datetime field", "summary" => "Datetime field with extended search syntax", "version" => "0.0.1", ); } /** * Match a date/time value in the database, as used by PageFinder * */ public function getMatchQuery($query, $table, $subfield, $operator, $value) { if($subfield != "data") { $value = $this->_sanitizeValue($value); $database = $this->wire("database"); if($database->isOperator($operator)) { $table = $database->escapeTable($table); $value = $database->escapeStr($value); $query->where("DATE_FORMAT({$table}.data, '%{$subfield}'){$operator}'$value'"); $this->log->message($query->getQuery()); } } else { $this->log->message("Regular query"); $value = (int) $this->_sanitizeValue($value); if($value) $value = date('Y-m-d H:i:s', $value); else $value = ''; $database = $this->wire('database'); if($database->isOperator($operator)) { $table = $database->escapeTable($table); $subfield = $database->escapeCol($subfield); $value = $database->escapeStr($value); $query->where("$table.{$subfield}{$operator}'$value'"); } } return $query; } }
    4 points
  5. Would you be available for Freelance work on a Processwire site? Starting ASAP, about one week work estimated by me (that is, someone who is not very proficient at processwire, but has 15 years experience programming). We have a pretty good spec. I'm very tempted to do it myself because the API is so damn nice, but I know I would be slower than a decent processwire guy. I don't even know PHP. The site is on a vagrant box, proper version-control, etc. Ideally, you should take care of deploying it too (we have SoftLayer, but we could go anywhere else if it's any easier). If you see yourself more of a designer, but know someone who can deal with the deployment, feel free to ping them. Deploying PHP is also something I would rather not do. It looks easier than pretty much any other tech stack, but I'm sure the devil is in the details. Details on the site: It's a two-sided platform, where devs meet companies, similar to hired.com but with a big difference: training. I want to combine plain recruitment with education. Companies don't have budgets for training (or have say 500eur/person/year)... this is scary because the fast-changing tech world will leave you behind, unless you spend time improving yourself. If the company doesn't spend money on training, then you have to find ways to catch up, probably over weekends and evenings. But companies do have big budgets for recruiting. Everyone assumes that you have to spend money to get good guys, and recruiters charge a good chunk of the first year salary for the hire. Companies budget for this. I want to get around the fact that there's no budget for training, by taking it from where the companies do have budget: hiring. So it's mostly budget relocation. But there's a clear benefit for the company: they get training 'for free'. And they get onboarding partially solved. It's common to hire someone and the assume that the first month is wasted, with the person getting used to the tech stack the company uses. We remove a big chunk of the problem. The core 'pages' are Dev, Company, and Course. There are user roles to limit access of companies to developers (for example devs that work for the company logged in). There are courses and devs can pick courses. It's a bit more complex than that. Please contact me only if you can start immediately on this project. The steps: - You contact me (on this profile, with a pm). - I will look you up, and if I like what I see, I will send you the spec. - You review the spec and send me a quote, both in time and in money. I may well be off thinking this is a week of work - We sign a contract, and you start work. No NDA silliness. You can open source any part of the site that you consider valuable as a PW module. We are in Berlin. Timezone : CET. Ideal if you are in town because we could work side to side, but remote perfectly ok.
    3 points
  6. Given the underwhelming response I am going to assume that not many people are using this module, so I am just going to update the Github repo with the new version. I used it a LOT yesterday and it seems to be working great with the new Table pagination feature. I have removed 2.7 and below from the compatibility list for this module. It is now only 3.x (or 2.8). If you need the old version that support 2.7 and below, you can grab it from this commit: https://github.com/adrianbj/TableCsvImportExport/tree/b83df4d13fd18fcb6c4bc8ac467e6ae35cba9711 Hope some of you out there will find the new version useful.
    3 points
  7. @SamC in your example, all of your variables are things that you can access directly from $page, so you could, if you wanted, just pass in $page instead of all of those individual variables. If you have anything extra you want to add, you can just add it. Just be careful not to accidentally override the built-in properties & methods. $page->any_key => 'any value'; $page->another_key => 'another value'; echo wireRenderFile($page->template->name.'.inc', array('page' => $page)); // everything in $page will now be available within this template
    3 points
  8. @usillos I'm not available for work at the moment but I want to say that I like the quality of your job description; really nice! Great that you include the timezone and location info too. Thanks for that - and hope you get a great bunch of devs replying to it!
    2 points
  9. Ryan gave an example of how to do this in a blog post recently.
    2 points
  10. Hey Pete, It's all a combination of Pages and FormBuilder. Although, there's no need to use FB, I was just piggy-backing on some other systems I built. You could do all the same stuff without FB at all. Short explanation: We have lots of these systems, and there are even multiple Help Desk types, so there would have been hundreds of PW fields. Instead we use FormBuilder for creating the input method, and then send certain parts of the data to a PW page. It probably sounds complicated, but it's really not. Ultimately everything is a page. The relationships are maintained with Page fields. InputfieldMarkup provides a way to display some of the related data (like the effected equipment list) in whatever format we need. It makes it fairly easy to style it however you'd like.
    2 points
  11. 2 points
  12. Calling arbitrary MySQL functions would be nice, but I think these date features should probably be a different topic, as I'd prefer it if they also worked for filtering PageArrays. That would AFAIK mean using a wrapper class in place of the plain timestamp that is currently used as the unformatted value though. Got to fiddle with that when I have time in the evening.
    2 points
  13. Sure, there are just no database backed constraints. The benefit of building a custom frontend is also the biggest drawback: It's custom. In the backend you can harness a lot of already existing functionality, which works if that's how you need to handle things, but might get messy if you need to work against it almost everywhere.
    2 points
  14. Hi Daniel, welcome to the forums You could use the approach described here:
    2 points
  15. I like to think we are ahead of their pace Those guys don't have a console panel, or a persistent dumps recorder, live template tester, or any of the other cool goodies that we have I'll see what I can do - I agree it would be nicer to not have to write the array with the keys for those options.
    2 points
  16. Thumbs up Adrian! Is it already Christmas?
    2 points
  17. Hi everyone! The latest version makes use of the Tracy core's LIVE dump feature in several places, including the PW Info panel, the Template Resources panel, and whenever you use bd() From my initial testing this seems to have made huge differences in the size of the DOM required by Tracy, especially if you have a heavy page where before the PW Info panel (especially if you had the objects displayed) could be huge. It is also magic when you want to do a dump with a custom (greater than default of 3) depth, eg: bd($page, 'Page Object', array('maxDepth' => 10)); What was 29MB is now only 3KB - that's right, I have got those MBs and KBs correct! Once you start expanding the object and drilling down into, the rest of the object is added to the DOM as needed - very clever indeed! Anyway, please let me know if you find any problems with this change.
    2 points
  18. kuhl, the die antwood stuff is freaking hilarious, i couldn't work to this, would be too listening...
    2 points
  19. Hi everyone, I just added multi-language support to this module. I use it with alternate language file fields for translated versions of PDFs. In my example, I have these two fields: document_pdf document_pdf_portugues I am using this filename format setting: {$page->title} Now when I upload, the PDF gets renamed to match the title of the page based on the language suffix of the field, eg. a page with these multi-language titles: My Document Title (default) | Meu Título do Documento (portugues) results in pdfs named: my-document-title.pdf | meu-título-do-documento.pdf Please note that I am still pretty new to this multi-language stuff, so let me know if you have any problems or have ideas for improvements.
    1 point
  20. Thanks Adrian for this. I ll try it.
    1 point
  21. @antpre - Tracy has an easy and safe way to disable all autoload modules for testing if there is some interference: https://processwire.com/blog/posts/introducing-tracy-debugger/#module-disabler-panel That might help to narrow it down for you. Also, with Tracy on, you don't really need debug mode
    1 point
  22. Hacktoberfest is right around the corner this year. A great opportuniy for contributing to open source and specially Processwire ecosystem https://hacktoberfest.digitalocean.com/
    1 point
  23. I'd really like to see that in the core fieldtype.
    1 point
  24. Love the ListerPro already! This will make my clients happy.
    1 point
  25. Yes, but I meant Add New - to add a page from the Lister. I thought that was a feature of the Core version, but I had no Add New button.
    1 point
  26. Yeah @ryan needs to start pointing this module to the new repo: https://github.com/processwire/processwire
    1 point
  27. Hey Pete, What kind of functionality do these subsystems have? I don't see anything that you couldn't build in the admin. On a smaller scale, but somewhat related, I have a help desk system that has some similar relationships. Users There are about 20 fields associated with each user Tickets Each user can have multiple tickets Equipment Each ticket can have multiple pieces of equipment attached. The equipment may be assigned to the user, or it may not be. Those sound like they are similar to your User/Horses/Events Although, I don't have anything that's analogous to the payments You can build some pretty complex stuff in the admin, but if you have a lot of custom UI requirements, then you might end up fighting against it like LostKobrakai mentioned. I don't know if that gives you anything more to go on other than, "Hey, I've done something *kind of* similar".
    1 point
  28. @Jason Huck and everyone else working with large datasets: I'm playing around with DataTables, and these are the initial benchmark results for 6000 jumplinks. Jumplinks Manager containing only page markup: Server Processing = ~430ms Receiving = ~120ms JSON AJAX request for DataTable: Server Processing = ~6320ms Receiving = ~110ms (reduced as there is no bulky table markup) Peak Memory = ~52MB (much better, also reduced to lack of table markup) Essentially, the loading time has been cut in half. However, this will be further improved the links for the table are being processed server-side via Eloquent accessors. I'm going to move that to client-side processing to cut down the load time even more. There is the option of server-side processing on a per-page basis, but I think that's overkill. I'm pretty new to datables, to be honest, and so not sure how to do a whole bunch of things. But I'm sure it'll be easy enough (readthedocs, hehe).
    1 point
  29. thank you mate, I will try to play around the API and follow the post!
    1 point
  30. What about the Access tab of the field settings
    1 point
  31. You got me right. Ok, will go for CustomAdminFiles.
    1 point
  32. So you want the fields from the content tab to still be there, just not the tab "button" (for want of a better description)? That sounds more like a job for CustomAdminFiles or maybe a feature request for AOS? This module hides entire tabs, including their content. Am I on the right track now?
    1 point
  33. $options = <<< _END value|Title value2|Title2 _END; $newField->type->manager->setOptionsString($newField, $options, true);
    1 point
  34. You could try play with these lines to find something, it's hard to fix something I can't see
    1 point
  35. Hi @spacemonkey95. Thanks for the purchase. Media Tags: The purpose of 'media tags'...is the same purpose as in ProcessWire (please note: all media can be tagged; not just images); namely, to group related media (images, documents, video or audio) to fulfil any number of functions - easier organisation, finding related things, etc. Filtering media by tags: Yes, it is already possible to filter images (or any other media) by tags both in the API and in your Media Manager Library (the Process Module). Please see the gif below. What is pending is the ability to tag multiple media in one go. Currently, one can only tag one media at a time as shown in my post above. This can be tedious, hence the need for multi-tagging capability. I have started work on this new feature but it won't be ready this week but soon. It is also not possible, currently, to sort media by tags (i.e. the display of media in the Media Library - currently sorted by title). I am also working on implementing this. Hope I've answered your questions. Filtering media by tags
    1 point
  36. The reason for this is explained in the "code internationlisation" docs page. Small hint: It's because of the parser and the ability to have comments for translation on the same line.
    1 point
  37. you would need something like this in your old site's root folder htaccess RewriteEngine On RewriteCond %{HTTP_HOST} www.thepaleofix.com.com [NC] RewriteRule ^(.*)$ http://www.dranthonygustin.com/$1 [L,R=301] Once the URLs are all forwarding from the old domain, you would then use a combination of htaccess 301, and Jumplinks (module) to handle the differences. because with the above rules if someone requests http://www.thepaleofix.com/resource/purepharma-m3-review/ they will definitely be redirected to http://www.dranthonygustin.com/resource/purepharma-m3-review/ so then your local 301 or Jumplink would do the 2nd 301 to the new page
    1 point
  38. If your php script uses the common mysqldump command, there are a gazillion options that can affect the size of the resulting sql file. For example, you can decide if you want to expand names to include full tablename.columnname or not, Or you can simply backup the database structure without data, you can decide if you want to include CREATE_TABLE in the backup or not, etc. For your reading enjoyment, you can look over the options available from this linux man page: http://linuxcommand.org/man_pages/mysqldump1.html I've never used phpmyadmin to create backups, but I'd imagine there are various options you can include/not include with pma too.
    1 point
  39. Good news. PW 2.8.x and 3.x already support whitespace. I didn't realize those versions were in separate repos: https://github.com/ryancramerdesign/pw28 and https://github.com/processwire/processwire. Ryan said 2.8 repo is probably moving to the processwire org github shortly.
    1 point
  40. Also. these gists by @Soma are good demonstrations: https://gist.github.com/somatonic/5011926 https://gist.github.com/somatonic/5236008 https://gist.github.com/somatonic/5233338
    1 point
  41. This isn't ProcessWire-specific, but the last time I checked, MailChimp hadn't updated their official PHP SDK for version 3.0 of their API (and all prior API versions will stop working at the end of 2016), so I have been using this handy-dandy little wrapper instead: https://github.com/drewm/mailchimp-api
    1 point
  42. Welcome to the forums @mciccone I haven't purchased ProDrafts so I can't give a definitive answer on whether the module has a schedule feature, but it wouldn't be too difficult to code your own solution using the API method for publishing draft pages: $page->publishDraft(); You would take a similar approach to the Schedule Pages module. That is, add a "publish_from" date field to your page template, and use a Lazy Cron hook to find unpublished draft pages with a publish_from date < now and publish them.
    1 point
  43. I haven't really read all of this thread, but just wanted to chime in with a brief overview of a help desk system I built. I can only show you screen shots from the test server — since the real one has sensitive data — but I think you get the idea. Unfortunately it's all pretty specific to our environment here, and was never intended to be released. Ticket List This is pretty small in the test environment. The lighting bolt icons open a modal that shows some "quick look" information for admins. Last comment, ticket history, etc... It's just a way to quickly peek into a ticket without opening it. Ticket View Many of these test tickets are filled with a ton of content, but here's one that shows some of the features. It's conversation based. You can attach specific equipment (we have several equipment databases managed in other PW modules). You can add files/images to any reply. Typical help desk stuff really. Reply options This is at the bottom of the discussion, a lot like it is here in the discussion forum. Agents can reply or create an internal note.
    1 point
  44. @ryan updated module, now you can update module directly from admin panel
    1 point
  45. Why not simply use Leaflet Map Marker, which uses OpenStreetMaps? Let the Google stuff rot.
    1 point
  46. Man Google is such a nice service provider. I cannot imagine how many google maps implementations they broke just by applying policy changes "as of now". I mean I didn't like instagrams move to only "approved apps", but at least they told people about is half a year beforehand.
    1 point
  47. Maybe the "new" permission suggestion screen, which ryan implemented for the various optional core permissions, could also hold optional module permissions.
    1 point
  48. Here's an example module that removes "Add New" button(s) on InputfieldPageTable on a condition (here if there's 2 ore more entries). Hook before InputfieldPageTable::render, then add hook after InputfieldButton::render. Since InputfieldButton is used by PageTable, we just use that hook to empty the returned markup for the button. Then remove that button hook after the InputfieldPageTable rendered. https://gist.github.com/somatonic/c9db5c43f10d050bb14d
    1 point
  49. After Ryan's latest incarnation of Blog Profile I wanted to see if I could learn something from there to my own workflow. It turned out very nicely and this seems like a perfect template approach for me. Wanted to share it with you guys. Folder structure under templates folder: templates/markup/ templates/markup/helpers/ templates/markup/layouts/ templates/scripts/ templates/styles/ And it all begins from here: templates/markup/index.php -this is the "complete" html file, it has doctype, head and starting and ending body. There is very little "logic" here, it's more like a container. There is one very important code snippet there though: <?php if ($page->layout) { include("./markup/layouts/{$page->layout}.php"); } else { include("./markup/layouts/default.php"); } ?> Code above goes between header and footer of your site, that will be the main content. I call it layout, but the better name would be "content layout" or "inner layout" or something like that. Then the templates/markup/layouts/ folder will keep at least default.php file, but probably few others, like "threeColumns.php", "frontpage.php", "gallery.php" etc.. you got the idea. Each of the actual pw template files are then purely "controllers" - no actual markup generated there. All markup are done in files inside templates/markup/ folder and it's subfolders. This is how template file templates/home.php on one site I am building right now looks like: <?php // Carousel items $t = new TemplateFile(wire('config')->paths->templates . 'markup/helpers/carousel.php'); $t->set('carouselPages', $page->carousel); $page->masthead = $t->render(); // Tour themes $t = new TemplateFile(wire('config')->paths->templates . 'markup/helpers/items.php'); $t->set('title', "Get inspired from our <strong>tour themes</strong>"); $t->set('items', $page->featured_themes); $t->set('description', $page->themes_description); $t->set('url', $config->urls->root . "themes/"); $t->set('linkTitle', "All themes"); $page->main .= $t->render(); // National parks $t = new TemplateFile(wire('config')->paths->templates . 'markup/helpers/items.php'); $t->set('title', "Seven beautiful <strong>national parks</strong>"); $t->set('items', $page->featured_parks); $t->set('description', $page->parks_description); $t->set('url', $config->urls->root . "national-parks/"); $t->set('linkTitle', "All national parks"); $page->main .= $t->render(); $page->layout = "frontpage"; include("./markup/index.php"); This uses few "helper" markup files from templates/markup/helpers/ folder (namely carousel.php and items.php). Here is the carousel.php for your reference: <?php /* Generates the markup for the frontpage carousel */ if (count($carouselPages) < 1) return; $styles = ''; echo "<div id='carousel'><ul class='rslides'>"; foreach($carouselPages as $key => $p) { echo "<li class='c-item c-item-$key'>"; echo "<img src='".$p->image->getThumb('carousel') ."' alt='' />"; echo "<p>$p->summary</p>"; echo "<a class='button' href='{$p->link->url}'>$p->headline</a>"; echo "</li>"; } echo "</ul></div>"; Then populates the $page->masthead and $page->main properties and then set's the inner layout to "frontpage". That templates/markup/layouts/frontpage.php file is very simple on this site, but could be much more complicated if needed: <div id="masthead"> <?= $page->masthead; ?> </div> <div id="main" class="wrap"> <?= $page->main; ?> </div> Frontpage is rather unique and I could have done all the markup on the frontpage.php file also. But I do want to re-use those "carousel" and "items" components on other places as well. But if I do have totally unique stuff, where I do want to get "quick and dirty" this approach allows it. Then my template file would be something like this: $page->layout = "campaign2012"; include("./markup/index.php"); And then all the markup would be in that templates/markup/layouts/campaign2012.php Blog profile really gave me a good ideas (cleaner folder structure etc) and using TemplateFile class adds nice possibilities. This is of course just a one way to manage your templates, but hopefully someone of you finds this helpful when thinking about how you like to structure this stuff. PS: If you are just getting started with PW, then I recommend using the head and foot includes method from demo install. There is nothing wrong with that method and only more complicated sites starts to benefit from these methods introduces in this topic.
    1 point
×
×
  • Create New...