DrQuincy
Members-
Posts
346 -
Joined
-
Last visited
-
Days Won
1
DrQuincy last won the day on August 30 2023
DrQuincy had the most liked content!
Profile Information
-
Location
UK
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
DrQuincy's Achievements
Sr. Member (5/6)
86
Reputation
-
Thanks @FireWire. I tried your PR code but it didn't work for some reason. I have ended up adding this to the $(document).ready() code at the bottom: $('.InputfieldMapMarkerAddress input[type="text"]').each(function() { $(this).on('keydown', function(e) { if (e.key == 'Enter') { e.preventDefault(); // Trigger Geocode by removing focus on search box this.blur(); return false; } }); }); It just prevents the form being submitted on hitting the enter key and blurs the input forcing it to geocode client-side. This seems to work for me although I haven't really tested it much yet.
-
DrQuincy started following File access control at field level rather than template , Map Marker Map , Slight formatting issue on login page after upgrade and 4 others
-
Has something changed with the module? Or has Google changed how the keys work? If you enter an address in the search input once it loses focus it geocodes on the front end. All good. But if you type a new address and save it it tries to geocode on the backend and you get a REQUEST_DENIED error since you can't have a key (unless you have it unrestricted, bad idea) that works by both referrer and IP address and both coordinate fields are set to 0. I'm sure it didn't used to work this way. Why does it even bother to do server side geocoding if you can only set one key? Is there any way to force it to geocode on the front end only? And sorry I might be misremembering but couldn't you click a point on the map and put the marker there? I can't seem to do that now.
-
I just upgraded to .255 and noticed the login user anme and password fields are really close together. Is there a fix for this?
-
This is something I've just noticed when settingup some redirect. Let me use an example on the processwire.com site: https://processwire.com/docs/ https://processwire.com/dOcs/ This both load the same page. Processwire does make the canonical tag lowercase. I just wondered though, is there a system-wide way of directing all requests that aren't files to be lowercase: www.site.com/files/I_am_a_PDF.pdf -> fine www.site.com/folder/I-am-a-Page -> 301 redirects to www.site.com/folder/i-am-a-page Thanks. 🙂
-
Great, thanks.
-
Forgive the possibly dumb question but what does this mean? I notice that the .255 tag has already been added. Does this mean that .255 will receive changes after the tag has been added or that there will be another new master version coming soon? I'm just deciding whether to upgrade my core PW site from .246 to .255 or to wait. Thanks, I love this CMS and its community!
-
I know how to create pages with the API and how to add images and files. I just wondered, though, if there was any in-buit way to handle instant AJAX file uploads as the backend does. As you know, if you submit the files with the rest of the form it can take a while if there are multiple large files. In the PW CMS, however, you upload them and they're applied on save and somehow cleaned up if not used. Is there any way to tap into this workflow or do oyu have to roll your own? Thanks.
-
File access control at field level rather than template
DrQuincy replied to DrQuincy's topic in General Support
Thank you @Robin S I'm pretty sure I did as you said and it didn't work but I have just gone back through. Template set to full access control Images field set to access control but View checked on all roles inc. guest Files field set to access control but View checked on all roles excl. guest And I have accessed the assets in a different browser not logged in and the images can be accessed but not the files. Perfect! My next question is, some of these pages will have a lot of images (20+) and each one of this will now create a new PHP/ProcessWire thread. Now I have got this working, I am worried about overloading the server. Has anyone much experience with this? I wonder if I should: Load the images one-by-one using JavaScript Each time a page is loaded for the first time after being saved copy the images to a public folder before the page is rendered Any other ideas? EDIT: I'm actually thinking make all assets public, prefix restricted ones with “restricted--” or something, block files with that prefix using .htaccess and then create a PHP file (restricted-file.php?file=foo.pdf&page-id=9999) that bootstraps PW and loads the file. I think that would be fairly simple and as light as can be on resources. -
File access control at field level rather than template
DrQuincy replied to DrQuincy's topic in General Support
I've now tried this out. @Robin S This is true but it seems to apply to all image and file fields assigned to the template. In this template I have an images field and a files field. I want the template and everything in it to be accessible by all roles except the files field. I have followed the instructions above. Template: everyone has view access, Prevent direct access… is set to Yes always… Files field: Access set to view for everyone except guest Image field: I tried this as is (manage acess control = No) but that didn't work so I explicitly set everyone to View What happens is PW adds a minus to the site/assets/files folder indicating access control but it seems to be doing it to all fields regardless of how the individual file and image fields are set. Is this expected or have I missed something out? Thanks. -
Let's say I have Fieldset Group called Tables that contains 3 x Pro Fields table. Each table is label, value where label is set via the API and is readonly (see below). If I set the field to be Closed on load, how can I set it so that if in any of the tables if value is empty instead of seeing a closed fieldset: Tables ... I get something like: Tables ... 7 missing values or Tables (7 missing values) ... (either is okay) Additional questions: I also want to hide the new row button but I think I can easily do that with CSS. Use this CSS: li#Inputfield_{myFieldName}pageText a.InputfieldTableAddRow { display: none; } How can I make the label field in the table readonly, add readonly=readonly to the settings for that column doesn't do it. Use this JS: $('input.{myFieldName}-label').attr('readonly', 'readonly').attr('onfocus', 'this.blur()').css('opacity', 0.6); How to sort the table A to Z by label Didn't realise there is a setting for this, great! Thanks. EDIT: Here's how I did it: \ProcessWire\wire()->addHookAfter('ProcessPageEdit::buildForm', function(\ProcessWire\HookEvent $event) { $object = $event->object; $form = $event->arguments('form'); $page = $object->getPage(); $page->of(false); if ($page->myField) { $toAction = 0; foreach ($page->$myField as $row) { if (!$row->value) { $toAction ++; } } if ($toAction > 0) { $form->prependMarkup('<div class="pw-container uk-container uk-container-expand"><div class="uk-alert uk-alert-danger"><span class="fa fa-exclamation-circle"></span> Check the <strong>Page text</strong> tab; ' . (int) $toAction . ' value(s) needs entering</div></div>'); } } });
-
File access control at field level rather than template
DrQuincy replied to DrQuincy's topic in General Support
Thanks @Robin S I will try this and report back. It might not be for a week or so as I have another project to finish first. To be honest, in all my years of using ProcessWire, I have never really worked with access control at the field level, only the template. But it seems like this is the kind of quick, simple and elegant solution you would expect from ProcessWire. I'm glad I posted here as my solution was way too convoluted! 😉 -
File access control at field level rather than template
DrQuincy replied to DrQuincy's topic in General Support
Thanks for that, and what a happy coincidence! I'm not sure I want to edit the core at this point but I appreciate your code snippet. I think my other idea is going to take a bit more work but can be done with hooks: Create a child template with access control and file field Add Integer Unique field to store parent page ID Add Pages::save hook to create and save child page (check for its existance first and create a new one if needed) Add a ProcessPageEdit::buildForm on the parent template to add the access controlled field to the edit form Add a Pages::delete hook to delete the child page when the parent page is deleted I think that should do it. I'll have to try it out though. I was hoping there'd be a simpler solution! -
In a template you can enable: Prevent direct access to file assets owned by pages using this template? And in site/assets the folder of that page has a minus prefix added so Apache tells PW to handle the file request. I have a situation where I want the top level page to have no access control but I also have a series of files where I need access control. I.e. it's a mix. I'm just wondering if I make the files be part of a repeater, can I set access control for the repeater only since it has its own ID. Will this work? I would guess that it does but I wanted to see if anyone has used this approach in production.
-
Yeah, I thought so. I'm using my own by the spam emails are still getting 0.9 (same as me!). I don't get these spam emails since there's nothing promotional in them whatsoever and yet they're making it passed everything.
-
Thanks, will there be no free allowance at all? What about the free credit you get per month with Cloud Console? I don't believe it, I just pushed this live for a client and right away they got a spam submission that scored 0.9/1! Judging by the contents of the form it can't possibly be a human. How on earth is it scoring so highly? Will Google “learn” from this once a few come through?