Jump to content

Leaderboard

Popular Content

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

  1. I am not giving you a checklist but a tool which can be helpful for "managing" the end of your project by writing tasks. Check out https://github.com/deployphp/deployer I personally use it in conjunction with Duplicator - but it can be used in any workflow, like rsync etc... - Once the package is created, you launch your task and the tool configure/deploy everything for you.
    5 points
  2. Permissions are much more involved both in the core code and in the database than roles. There are real (e.g. page-edit, always installed), runtime (e.g. page-create, not present in the database) and optional (also called "delegated", e.g. page-publish, used if installed, otherwise replaced with page-edit) permissions. The current implementation of hasPermission also uses the same code path both for global checks and contextual ($page, $template) lookups. Of course, that doesn't prevent implementation of a multi-permissions check per se. BUT. Since code and database are much more involved, running lots of individual permission checks can quickly become a performance killer. IMHO it is in often better to add your own permission (or role) than to run multiple consecutive permission checks in code. I know, that's not a solution, but I'm not aware of a built-in shortcut. Adding a User::hasOnePermission hook method that splits on the pipe symbol and calls $user->hasPermission for each term should be straight-forward though.
    4 points
  3. Yeah, you're right, they are very different behind the scenes so this may be the best way forwards. It is only ever going to be 3-4 at most so it should be fine performance-wise. Since I'm allowing the administrator of this particular app to assign roles to users as well as override and give users certain custom permissions outside of their role I have to check permissions for some things instead of relying on roles. Thanks.
    3 points
  4. Maybe this is a good starting point:
    3 points
  5. @theo The new function is based on the official WireFileTools::zip() function and I didn't saw this check. Nice catch ? It has not do with the issue I remember. I just checked and its a silly mistake I made while updating the module. Thanks again @theo . It will be fixed in Duplicator-1.2.10 I never ran into into this issue but it look like it can happen. I have a site with 600MB stuff and his database size at 1GB+, I have no timeout building the package or downloading issue. To me, it look like a server settings. If you can, please send me the server details so I can try to reproduce it. PS: still didn't found the time to check what is going on GoogleDrive. @szabesz any feedback about Dropbox v2 ? ?
    3 points
  6. Another hidden treasure in the PW Backend: PW 3.0.61 introduced the VEX library for dialogs: https://processwire.com/blog/posts/processwire-3.0.61-master/#admin-and-ui This is how you can use them in your custom admin pages: In your module's php load the vex library (eg in the ready() method of your module - init() might not work as it might load too early!) $this->wire('modules')->get('JqueryUI')->use('vex'); Then in your javascript: // show confirm dialog ProcessWire.confirm('Are you sure you want to delete this E-Mail?', function() { // on confirm $i.removeClass('fa-trash').addClass('fa-spin fa-spinner'); $.get('./trash/?mailid=' + $a.data('mailid'), function() { $a.closest('.RockGridWrapper').find('.rockgridbutton.refresh').click(); }); }, function() { // on abort grid.api().deselectAll(); }); Result: I opened a pull request with a little fix for handling clicks on the CANCEL button. If you want to support it, give it a thumb: https://github.com/processwire/processwire/pull/108
    2 points
  7. Hi folks I'm currently doing some work on a very customised system based on PW (naturally). Rather than do this to check a user has a role: if ($user->hasRole('admin') || $user->hasRole('editor') || $user->hasRole('role3') || $user->hasRole('role4')) { it's possible to do this: if ($user->matches('roles=admin|editor|role3|role4')) { Is there a similar way of doing this for permissions? I want to check in code if a user has one of several possible permissions before displaying something: if ($user->matches('permissions=perm1|perm2|perm3|perm4')) { ^^^ this doesn't work and I'd have to resort to $user->hasPermission('role') multiple times if there isn't a solution Not the end of the world of course, but this is neater/easier to read in the code.
    2 points
  8. I'm making progress! Current state is really, really nice. See these two examples of a feedback software that I've built for a client: full multi-language-support all kinds of custom cell stylings (backgrounds, icons, etc) custom filters filter by doubleclick on a cell (really handy) custom buttons-plugin (not part of aggrid): reload data via ajax (very performant thanks to RockFinder) reset filters fullscreen mode (really handy for large grids) excel export as CSV data reload grid automatically when a pw-panel is closed Another example: A list of all ratings for several categories See the bottom line: this is another plugin that is not part of aggrid. You can just show the sum of the column (like the second column) or render custom statistics (like min, max, avg). When you select multiple lines you also get the statistics only for the selected rows This is also an example how you can use pinned rows with aggrid (really awesome library!). Example of a range filter (aggrid standard feature):
    2 points
  9. If anyone is interested in Data Science (Machine Learning, AI, Deep Learning etc), then I highly recommend this course as your starting point. https://www.coursera.org/learn/machine-learning/ It’s offered by the Stanford Uni’s Andrew Ng, who is considered a leading pioneer in this field. The course is regarded as the starting point for any aspiring data scientist’s learning path. It's an 11 week course with a lot of subjects to cover, but Andrew Ng does an amazing teaching job. There is a lot of maths in the course, but don't be afraid of it too much. I was dreading it before the course, but it turned out unnecessary. You just need to know what a gradient is (of a straight line) and what the sigma symbol is (Summation). They also use partial derivatives, but you don’t need to know how to derive them. Matrix Operations are used heavily, but there’s a really good primer as part of Week 1’s syllabus. The course uses Octave/Matlab instead of R/Python etc. And the course feels more like a traditional Computer Science course where they really try and give you a good basic grounding in theory. Having said that, I thought the exercises you did got closer to real world problems as the course progressed. Whilst you will be very well grounded in all the concepts of Machine Learning, you will probably have to do at least another course or projects to learn how to apply this knowledge in the real world. I've also shared some tips here for newcomers of the course, if anyone is interested:
    1 point
  10. Just played around with one of my fun-sites and saw something that might clear your problem. Unless your homepage (id=1) doesn't have a "country-code url" multilanguage doesn't work properly on other side. Homepage: Other site: Default: http://nerd.to/processwire/snippets/ German: http://nerd.to/de/processwire/snippets/
    1 point
  11. Thanks! Looks great. Funny thing is, I have AoS installed, but overlooked that feature.
    1 point
  12. I am still confused where you at and what you are trying to achieve: The form is on a product page and you want to store the selected number of products to display in the cart later. The form is at the end of a checkout process and you need to make a new order ...something else, like my 1st assumption. But let's think you know what you are doing and you want to save shopping cart contents (one or many product, quantity and price) to database and make that connected to the user currently logged in. You need to decide, where are you going to store that data in PW, choose a fieldtype for that. It can be a Repeater, ProFields Table or some specially crafted custom fieldtype. Those all fit as the are capable of storing random number of defined data (product, quantity and price). Them you need to create s field based on that fieldtype and configure it. Than add it to desired template. Depending on your case you could add that field directly to user template. But much more likely you need to create a new template (probably, "order" or something like that) and add this field there. On form submission you would use PW API to get the data from the user $input and save it in the created field on use page or order page. How to do that depend on the chosen field and template it was added to. Explain the case better please.
    1 point
  13. Can you provide examples/code that will help us to understand the problem and/or result. How many repeaters do you use? How do you call/query them? How do you want them sorted? I just tested it with 6 repeater items in a single page and get the results I expected.
    1 point
  14. I do not have too much extra time these days so I postponed testing it, also because you mentioned possible idrive support and I thought I would wait for that too, I was thinking about testing both "parallel".
    1 point
  15. hey @Wanze I stumbled into an issue after updating the module I ran into some time ago before deploying a site on a Windows 2008 server. The issue is described there And the fix there : Each time I don't remember where the issue come from and I have to google it and re-read my thread. Are willing to accept a PR ?
    1 point
  16. Thanks guys, I also have some multilanguage website, but some words can be the same in all languages (for example: "note", that it is my case). If there is no solution to that maybe it's good to keep in mind not to use common words as classes or data-attributes in textarea.
    1 point
  17. Hey @Robin S I have not had the need for that, but I also haven't come across the page path in the db... One option would be the "Page Paths" module in the core section of the modules, that says: Another option would be a field populated by a saveready hook. This could also be multilang. But I guess you want it directly from the DB? The saveready hook would maybe not be a good solution if you rename a parent with 1000s of children... you would have to take care of those situations and also it would be slow. Maybe you could build a query that joins all the pagenames together to one path? You would need to define a max nesting level then, I guess... Maybe that query would be slow? Sorry, no better ideas atm
    1 point
  18. To append to that: Autoloaded fields are retrieved by getById() as you said, but non-autoloaded fields are retrieved on first access of the fields property from the page ($page->my_field) as a separate query. This is an important fact to consider when needing performance, as that default behaviour is quite prone to cause n+1 queries.
    1 point
  19. An interesting read about the dumb way autoplay restrictions are implemented in mayor browser these days: https://www.construct.net/hu/blogs/ashleys-blog-2/how-browsers-should-handle-autoplay-restrictions-954
    1 point
  20. My regex is rather weak also, but I think this will work... $cc = $modules->get('ServiceCurrencyConversion'); $text = $page->body; $regex = '/\x{20AC}([0-9]+\.?[0-9]+)/u'; $text = preg_replace_callback( $regex, function($matches) use ($cc) { $dollars = number_format($cc->convert('EUR', 'USD', $matches[1]), 0); return "{$matches[0]} (\${$dollars})"; }, $text ); echo $text; Would makes sense to put this into a simple Textformatter module and use it that way. See TextformatterNewlineBR for a basic example to start from.
    1 point
  21. @Andreas Augustin It's interesting - if you dump/log the $value here directly in InputfieldTextarea::processInput you can see that the method is called for every language. However, you can only actually hook the call for the default language - for the other languages the method must be called in such a way that hooks are not triggered (by calling the method name with the three underscores included). So you'll probably have to get the other language values from $input (either the WireInput argument to the method or via the API $input variable). For example... $wire->addHookBefore('InputfieldTextarea::processInput', function(HookEvent $event) { $inputfield = $event->object; $input = $event->arguments(0); if(!$inputfield->hasField || $inputfield->hasField != 'your_field_name') return; // The value for the default language $default_language_value = $inputfield->value; // The value for French language $french = $this->languages->get('french'); $input_var_name = "{$inputfield->name}__{$french->id}"; $french_value = $input->$input_var_name; // ... });
    1 point
  22. Basically, a lot of what wbmnfktr says. If the project is a bit more complex, I do schedule a time to sit down and go over the backend to see if they are having any hang-ups, or if they have tried to "force" the system to work in a way it was not developed for. Sadly, this seems to be an ongoing issue, and I spend a lot more time trying to clean up areas of the page tree where they have just dumped pages and claim the system is broken due to their lack of understanding/forgetfulnes. If everything has gone smoothly and any scheduled change(s) are complete, I do send out an email with a url to a survey to gather a bit of information on how the project went and how the processes could have been better tweaked.
    1 point
  23. I wouldn't call them beautiful. It does its job.. but beauty is in the eyes of the beholder etc.etc. I first encountered that vex thingie just a few days ago - and it didn't work. I'm still trying to find out why no one else was able to replicate that behaviour... I'll dig deeper when I have more time.
    1 point
  24. In our dev team, for each !important anyone uses in his code, he/she has to donate 5 bucks and stand in the corner for an hour, deeply ashamed. But back to the topic at hand: You should be able to inspect and see if all these framework-classes are actually there in your CSS. Are you compiling from SASS? Perhaps there's a helper/utility .scss that you don't include. this, however sounds strange. You really should give us more background infos about the big picture.
    1 point
  25. There is a couple long trending repos with checklists on github: https://github.com/thedaviddias/Front-End-Checklist https://github.com/thedaviddias/Front-End-Design-Checklist ...and a whole lot more of alike here. I know, I 'm not sharing something of my own as you asked, but a something to start with anyway.
    1 point
  26. This week's version of ProcessWire on the dev branch continues resolution of GitHub issue reports, and it also adds a new text truncation function to our $sanitizer API, something requested from our requests repository: https://processwire.com/blog/posts/processwire-3.0.101-core-updates/ We didn't have a blog post for last week's version 3.0.100—see the core updates section in ProcessWire Weekly #207 for more details on that version.
    1 point
  27. Thanks Ryan - this truncate method looks awesome - way to over-deliver
    1 point
  28. If I want to show both in the same page, how I can do? I tried to make an array like this $input->get->["register, login"] = 1 But yes I know it's wrong. UPDATE: Ok I have fund the solution in this way: <div> <!-- The Modal --> <?php $loginRegister = $modules->get('LoginRegister'); $out = ''; if(!$config->ajax) { // if not ajax, show markup $out .= ' <div> <!-- The Modal --> <div id="myModal" class="modal"> <!-- Modal content --> <div class="modal-content"> <span class="close">×</span> <div id="LoginRegisterDiv">'; } // call the module LoginRegister $out .= $loginRegister->execute(); // this render the login form if(!$config->ajax){ $out .= '<div>'; } $input->get->register = 1; $out .= $loginRegister->execute(); // this render the register from if(!$config->ajax){ $out .= '<div>'; } if(!$config->ajax) { // if not ajax, show markup $out .= ' </div> </div> </div> </div>'; } $content = $out; // delayed output // or echo $out; // direct output ?> </div> I load the form inside a modale box, for this there are more code. But the focus still is in creating two different separate renderings.
    1 point
  29. I guess it depends on the file size of the ZIP file. Big files cannot be downloaded for example if not enough memory is allocated for the process. I always download the ZIP files via FTP which is reliable in my case.
    1 point
  30. Not sure if it's all servers, but I am finding the downloading a package from Setup > Duplicator is resulting in partial downloads. I don't have time to investigate at the moment, but just a heads up in case someone is trusting the download to be complete.
    1 point
  31. @pwfans i have it running well on a large PW3 site. Did you run into some problem? I didn't need to add any namespace or do anything in particular, it just works.
    1 point
  32. There is another issue in my case: The parent folder is included in v 1.2.9. Probably has to do with mod_userdir. So it does not work because it is extracting everything to /parentfolder/wire etc. As the above issue, this was all working in v 1.1.7
    1 point
  33. OK, I had a quick look at the source of Duplicator.module On line 640, there is a "isWritable" check: if(!$f->isReadable() || !$f->isWritable()) { continue; } Why does the file to copy have to be writable? My "wire" folder is not writable by "wwwrun" because it is not necessary, it has to be readable though. If I remove this check, it works as before. Thank you.
    1 point
  34. @szabesz Probably you remember my "special" setup. I had some problems before 1.1.6 in the area of mod_userdir and this: Maybe the current problem is related?
    1 point
  35. I have completely uninstalled and deleted it, even checked in the db for the module entry, then downloaded and installed the latest version (1.2.9) and no, it does not work as before. The wire folder is not included etc. The package is only 2.11 MB instead of more than 20 MB before. Thank you.
    1 point
  36. Maybe I still haven't enough websites on my shoulders to see the use of it, so I should install and evaluate it. What about scripting your cpanel over the web ? Does anyone know if there exists a scripting language for automating cpanel tasks ? I don't mean cronjobs but something like cUrl.
    1 point
  37. It all depends on your workflow. Also, Duplicator is not just about cloning a site but for creating backups. Normally I use it for daily backups and/or for quick backups before "performing sensitive changes", just to be on the safe side...
    1 point
  38. I am running version 1.2.9 without issues on two sites. You might want to double check and re-save your settings. There might have been changes regarding the way the module stores what to include and what not to.
    1 point
  39. Hi Latest Duplicator does not work here. It does not include ./wire and other stuff. Version 1.1.7 works. Thank you.
    1 point
  40. It's done, will be added to the next aos update. I've borrowed some code from @Robin S modules (thanks!) as I haven't added config inputs to fields so far. In fact I totally forgot about this asmSelect snippet of mine, thanks for the reminder
    1 point
  41. When you request $page->url, ProcessWire generates it on the fly, kind of: it's a combination of $config->urls->root and the path of current page. Root URL is defined when the system is started, and $page->path is constructed from the names of parent pages. Similarly $page->httpUrl is a combination of protocol, hostname and $page->url
    1 point
  42. Does what it says on the tin - about 250 bytes of CSS. http://mourner.github.io/dead-simple-grid/ For when Bootstrap, Foundation, etc are a bit too much. (I was sure I had seen this mentioned in the forum before, but a search didn't find it.)
    1 point
×
×
  • Create New...