-
Posts
4,046 -
Joined
-
Last visited
-
Days Won
67
Everything posted by Pete
-
Can't write a guide for a module that has the word "Simple" in the title @kongondo - you'll need a bigger hat if these guys carry on much longer
-
But the major and minor fields on the page would already have the last major or minor version numbers in them so I guess I'd just have to do a quick AJAX query to see if the values had been changed at all. Or actually I could just grab the initial values with JS on page load and see if either has changed on page save. I could also use some more JS to make sure they only increment the minor version by 1 and if the major version is incremented the minor versions is set to 0, but then if they mess it up you need an "undo" button. My head hurts. Maybe I should just give them the ability to type whatever number in the boxes and urge them to just do it correctly
-
The main reason for the modal is we want to make it something that people HAVE to do before the page will save (otherwise they might not) but we want it to increment by one on the major or minor field depending on what they click. I figured making it a modal would give more scope to expand it if we needed to. Basically I'm trying to make version numbers idiot-proof so that one or the other always increments on save, but it's down to the user whether it was major or minor edit. I try not to do anything particularly straightforward I guess an easy first step in the meantime is to have both fields be visible in the editor and just have a confirmation box popup asking the user if they updated the version number so they remember to check it. It's not as foolproof, but it would be a start.
-
I'm building a ProcessModule to handle pages that store a version number. Everything is pretty straightforward apart from the last part. What I want to happen is that when the Save button is clicked instead of saving straight away a modal window pops up asking if the changes made were minor or major, and depending on which button is clicked (minor or major) the minor or major version number is incremented. Since the minor and major version fields are hidden in the editor, I'm not even sure how to save those (making them hidden doesn't make them a hidden field - they simply don't get rendered) but I suspect some AJAX to append them to the end of the form might work. My bigger problem is I've no idea how to launch and interact with this modal on page save. My brain seems to be drawing a blank on every aspect of this one, but I suspect there would be other uses for such modals on page save. Any suggestions would be greatly appreciated
-
People get married - that's the only time they would change aside from typos (both of which I've had to deal with).
-
@teppo - I've got a marginally modified version of the AD module working, but to be honest AD is a pig to work with unless you know it inside out. I know it just well enough to get it to authenticate and that's about it - taking it further than that is hard work as it's hard to work with. Something like ADLDAP would be the way to take it further I think: http://adldap.sourceforge.net/wiki/doku.php?id=documentation_user_functions But even then, look at the docs - there doesn't seem to be something as sensible as a unique user ID in Active Directory so if you rely on the username from AD and someone changes the username on the AD server then your matching PW user account won't work. Of course if you only need it for a bit of frontend authentication then it's not a problem, but if you want to match up an AD user with a PW user like I do on an intranet system I use then you have to be vigilant when changing usernames in AD. I think I've thrown myself into a recursive loop and repeated myself a bit there, but that's the kind of headache it gives you It would be great if there was a really good PHP API for AD that dealt with basic things like user authentication and reading/writing to user accounts (the basics in my opinion) but every one I've looked at gives me a headache. But then I am spoiled by PW's API
-
$selector .= ", branche=$branche"; Note I moved the comma before the branche= and contract= when I did my examples a few posts up
-
Erm... that doesn't make sense. If the $selector variable is empty (as in neither branche or contract are being searched for), it translates to this when the variables are parsed as text (note the blank space after the comma as $selector contains nothing): $selects = $pages->find( "template=child-template, " ) ); My way would work and you wouldn't end up with a trailing comma.
-
Well a 500 error simply means there was something broken in your code. Returning "nothing at all" (I'll assume it returned no results is what you mean) means you were closer to getting it right but the selector probably needed tweaking. You can change the last bit of your code above to simply be: // Search pages $selects = $pages->find( "template=child-template, $selector" ) ); There's no need to import into an empty PageArray unless you were merging multiple PageArrays, so just doing the above results ina single PAgeArray anyway. Your code looks like it should be fine but will always result in a trailing comma in your selector (both the $selector.= lines end in a comma) so you should put the comma before the branche= and contract= lines and change your final selector to look like this (no comma): // Search pages $selects = $pages->find( "template=child-template $selector" ) ); Whole thing then looks like this: $selector = ''; if($input->get->branche) { // Get the criteria and sanitize them $branche = $pages->get("/branche/" . $sanitizer->pageName($input->get->branche)); if($branche->id) { $selector .= ", branche=$branche";//CHANGE YOUR SELECTOR AS SHOWN HERE $input->whitelist('branche', $branche->name); } } if($input->get->contract) { // Get the criteria and sanitize them $contract = $pages->get("/contract/" . $sanitizer->pageName($input->get->contract)); if($contract->id) { $selector .= ", contract=$contract";//CHANGE YOUR SELECTOR AS SHOWN HERE $input->whitelist('contract', $contract->name); } } // Search pages $selects = $pages->find( "template=child-template $selector" ) );
-
I guess another way to put that is "modules in PW follow some sort of convention in the way they are presented rather than modules in other systems where you can't predict how a module author might display the data in the admin" Well in 2.4 admin themes are modules, so it wouldn't be massively difficult to override the user's choice and show a different theme (though not sure why you would). During install using 2.4 you get to choose the theme and the next step after that shows the installer using the new theme so there's probably some code there. Alternatively if you just wanted to hide some things there are numerous ways including editing the default.php template file in the admin theme and showing certain things to certain roles (though there are better ways than that depending on your needs).
-
I like Soma's example above as it contains a few things I didn't even know were possible (and I've been here 3+ years ). The only other way that might work for you is merging two PageArrays, like this (from this topic: https://processwire.com/talk/topic/3384-search-with-merged-pagearrays-pagination-not-working/): $selects = new PageArray(); $selects->import( $pages->find( "your first selector" ) ); $selects->import( $pages->find( "your second selector" ) ); $selects now contains pages from both selectors.
-
If they're hours as in 24 hours in a day, could you not just do something like this: for ($i=0; $i <=23; $i++) { // Regular PHP - see http://www.php.net/manual/en/control-structures.for.php echo '<a href="' . $page->url . $i . '/">' . $i . '</a>'; // which will output as <a href='/your-page/4/'>4</a> - well, it will output 0 - 23 in this way so you'll have 24 hourly links for example } Not quite sure what you mean by "link" in this case, but you could use something like the above with a selector that uses the urlsegment and searches for pages with 4 in the rangeslider field - see this example adapted from the rangeslider instructions for the selector if you wanted to match any page with a range that encompassed "4": $pages->find("range.min<=4, range.max>=4"); // So if minimum is less than or equal to 4 and maximum is greater than or equal to 4, get those pages. You'll probably want to specify a template as well but you get the idea
-
Raymond - did you see my ProcessDashboard module?
-
This is great as it's Something I've wanted to do on a couple of projects the last few weeks, thanks!
-
Can I ask about the app for a sec - what's the benefit over a fully functional mobile admin theme? The API makes an app easier to accomplish than in many other systems but unless there's a clear advantage I'm not sure I see the point to be honest.
-
What Teppo said - since the admin user is a known ID it would be trivial to log in as the admin this way and wreck your site (or actually install a module like Hanna Code, throw in some PHP and do significantly more damage to your server). It's an extremely bad idea.
-
Include & Bootstrap Processwire - How To Access Admin pages
Pete replied to Gazley's topic in General Support
I think you would have to stick Pw in a subfolder then but you would get the subfolder name in your Pw page urls. Or was that what you mean in your question? How to remove the subfolder from the Pw urls? -
Though I've just told my client's boo-boo, I did very recently tip an entire cup of tea all over one of these: http://www.logitech.com/en-gb/product/illuminated-keyboard-k740?crid=26 The keypresses just aren't what they used to be - smooth and quiet has turned into a bit clicky, but at least they stopped sticking after a few days! Marginally cheaper than Joss' recording desk but I was still annoyed with myself.
-
I still use the default install setup of including head.inc and foot.inc the most to be honest (mostly through habit), but there are many ways to approach it as kongondo says.
-
Also an ex-MODx'er myself. It's been fun converting some very different sites over the past few years as things that required a lot of custom code and queries in snippets in MODx to something that's much more manageable using the API in ProcessWire templates. Kidderminster-Husum-Twinning Before: https://web.archive.org/web/20130726180253/http://www.kidderminster-husum-twinning.co.uk/ After: http://www.kidderminster-husum-twinning.co.uk/ StrategyCore Before: https://web.archive.org/web/20120118171718/http://strategycore.co.uk/ After: http://www.strategycore.co.uk/ Etc etc
-
Someone I work with was busily deleting files fro the Windows folder one day to free up space because "they didn't seem to be anything he recognised as being relevant". Same chap also had his laptop on a boat on a sailing holiday and it got soaked when a big wave came over the side. I constantly threaten him with his next laptop being one of these:
-
Site Profiles from Modules Directory as install option
Pete replied to Roope's topic in General Support
I'm not sure about it to be honest (which probably goes against what I've said on the subject when it's been mentioned before ). I mean, the user will have just done some manual work to get the files onto their server to begin installation anyway (even if they use the single file installation method) so it shouldn't be too daunting for them to put a different profile in the right place. What might not be a bad idea as a first step towards this is maybe mention on the first step of the installer that other profiles are available with a link to them? -
I'm going to highlight this again horst as it's the important bit So whether yours or Teppo's module is installed or neither, emails can still be sent using the default Wiremail class. Therefore if I'm writing a module that requires email sending functionality, it needs to be able to use the same functions whether it's ryan's base module, the SwiftMailer class or your own module or module authors won't know what to expect. I think these WireMail modules need to be coordinated somewhat so that whatever the base class supports, the other classes also support so there are no surprises.
-
The problem with just implementing it in Swiftmailer (or in your class) is this from ryan's first post: So I can't count on the user not just using the default WireMail class and certain functionality not being available. I think that the WireMail base class needs to have these functions set up before subclasses (is that the correct term?) implement features or we'll have issues with things working consistently or we'll have to do some checks to see which Mail module is installed. My usage in this case is writing modules that use the WireMail class, so I need the functionality in the base class to be sure that the emails will definitely send
-
Can we have options for CC and BCC please ryan (and then Teppo in SwiftMailer )? It's not mega urgent, but these do come in handy in a few situations.